Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 12 min read Case study mediumAdept

Shopify's Path to a Faster Trino Query Execution: Custom Verification, Benchmarking, and Profiling Tooling

Shopify's Data Reliability team built a lightweight Python library on trino-python-client to orchestrate Trino queries, with three uses: PyTest-based verification suites, TPC-DS benchmarking across scale factors, and profiling through traffic generation and query replay. Verification tests use fixtures and marks (correctness, performance, production_only), and a multi_cluster pattern compares a candidate cluster against a standby control. Background queries discard results so hundreds of parallel queries can stress the cluster without exhausting client memory. This was used to evaluate storage caching and Kubernetes horizontal pod autoscaling. The tooling also helped a Trino upgrade succeed with p95 execution time holding steady, and the team stresses that sound statistics and awareness of environment differences are critical for performance testing.

Assumes: SQL query enginesPyTest fixturesdistributed clusters basics

Related posts

  • Shopify's Path to a Faster Trino Query Execution: Infrastructure

    Shopify Engineering mediumAdept

    Shopify scaled its Trino interactive query infrastructure on GKE by moving experiment queries to a dedicated cluster via Trino Gateway header routing and capping hardConcurrencyLimit at 60 to relieve coordinator lock contention on the resource group. Further fixes were applying JVM PerMethod/PerBytecodeRecompilationCutoff settings, which stopped hot methods from falling back to the interpreter, and setting task.max-drivers-per-task to 16 so a single query can't monopolize worker threads. Simply doubling worker size didn't stabilize performance, but these changes brought P95 query execution time below 30 seconds without any storage changes. Planned next steps are moving JSON to Parquet, adding an Alluxio cache, and improving table statistics.

  • Finding performance wins in our own traces with a coding agent

    Sentry mediumAdept

    Pairing a coding agent with the Sentry MCP over Sentry's own production traces surfaced dozens of small backend fixes that together removed hundreds of millions of queries a week. Django SDK spans with SQL descriptions, query-source file/line attributes and user agents let the agent rank hot paths. Each SQL change was validated with EXPLAIN ANALYZE on a read-only Postgres mirror. Wins included splitting a GroupHistory ORDER BY/LIMIT query into per-status probes (935ms to 0.4ms), adding a missing pagination index, eager-loading related objects, batching cache writes with bulk_set, and skipping a needless UPDATE running ~10k/s. The post ends with example prompts for hunting N+1 queries and unindexed queries in your own app.

  • CockroachDB Redefines Database Performance with Real-World Testing

    Cockroach Labs hardMaster

    Cockroach Labs argues that traditional benchmarks like TPC-C, designed in 1992, measure peak throughput in pristine lab conditions and end the test once a power pull disrupts steady state, so they say nothing about behavior during failures, maintenance or recovery. Their proposed "Performance under Adversity" methodology runs seven escalating phases in one continuous run: baseline, internal operational stress (CDC, backups, schema changes, rolling upgrades), disk stalls, network failures, node restarts, zone outages and regional outages, measuring tpmC throughput, p90/p95 latency and recovery time to baseline. The runs used CockroachDB 25.1 across three geographic regions with fault scripts published in the repository, though they depend on internal tooling and cloud accounts and cannot be run as-is. The accompanying interactive dashboard replays the scenarios; no comparative results against other databases are given.

  • How we stress test and benchmark CockroachDB for global scale

    Cockroach Labs easyNovice

    CockroachDB is exercised on a regular cadence of daily, weekly and per-release benchmarks, plus ad hoc and customer-partnered tests, mainly TPC-C, TPC-E and a YCSB-like KV workload. Reported figures include about 3,000–3,500 txn/s on a 3-node TPC-C cluster and 1.7M tpmC on 81 nodes. KV write throughput scaled from 160k QPS on 20 nodes to 1.2M QPS on 200 nodes, and TPC-E reached 40K txn/s on 96 nodes. Long-running release tests run workloads while backups, changefeeds, upgrades, schema changes and regional failures happen concurrently. That testing led to a recommendation not to use expiration-based leases above 10,000 ranges per node.

  • PostgresBench: A Reproducible Benchmark for Postgres Services

    ClickHouse mediumAdept

    PostgresBench is an open, reproducible benchmark for managed Postgres services built on pgbench's TPC-B-like workload (256 clients, 16 threads, 10-minute runs, three runs each) at ~100 GB and ~500 GB scale factors, with default configs, HA disabled and all services in us-east-2. In the first cohort, ClickHouse's NVMe-backed managed Postgres reached about 28.7K TPS on 16 vCPU/64 GB at 100 GB, versus 14.8K for Crunchy Bridge, 12.6K for Aurora, 8.6K for Neon and 8.1K for RDS, and held about 26K TPS at 500 GB. ClickHouse attributes the lead to co-located local NVMe storage, which avoids network round trips on every fsync and WAL commit in write-heavy workloads. Scripts and raw JSON results are on GitHub for verification and community submissions, though the vendor-run setup and absence of pricing comparisons are worth weighing.

The quest for software engineering knowledge.

Look:
Layout: