A behind-the-scenes look at building interactive analysis capabilities in Benchling

Wonja Fairbrother, Eli Levine11 Jun 2024

Problem

Scientists analyze the results of one experiment to design the next, and they expect filtering, pivoting and curve fitting to feel as fast as on their own laptop. Sending the data to another system breaks that loop. A team that wants this inside its application must serve many customers at once. It must also keep column types intact and stay within a latency budget. Per-user kernels or caches add state to manage, which delays the first working version.

Example from the article: Benchling lets scientists transform, chart and fit data (for example IC50 and other curve fits) from lab results, instruments and uploads without leaving the application.

Solution in brief

The web app writes input data as Parquet to temporary S3 and calls a stateless auto-scaling service. The service loads the file into Arrow, runs the transform with DuckDB for SQL-like operations or pandas and NumPy for statistical ones, and writes Parquet back. A measurement showed that reloading from S3 costs only about 350 ms, so session caching was not built.

Questions this case answers
  • How to serve interactive tabular transformations to many tenants with low latency and no per-user server state
  • How to combine a SQL engine with statistical libraries on the same in-memory table without conversion cost
  • How to run filters, aggregations and curve fits on user data inside a product with sub-second latency?
  • How to decide whether an interactive analysis backend needs session caching or can stay stateless?

Tools and methods

  • Parquet — columnar file format for input and output data, with a type schema attached
  • Apache Arrow — in-memory columnar table shared by all engines, zero-copy conversion
  • DuckDB — in-process SQL engine for basic transformations
  • pandas and NumPy — advanced statistics such as four parameter logistic (4PL) regression
  • Amazon S3 — temporary input and output storage with a lifecycle rule
Continue reading — it's free

Google or a one-time email code. No password.