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: Infrastructure

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.

Related posts

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

    Shopify Engineering mediumAdept

    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.

  • How Lyft powers batch and real-time analytics with ClickHouse Cloud

    ClickHouse mediumAdept

    Lyft replaced Apache Druid with ClickHouse, first self-managed and then on ClickHouse Cloud, for analytics that read over 450 TB and write about 4 TB per day at hundreds to thousands of queries per second. Batch jobs are defined in TOML files that specify a Trino aggregation and the target table layout, read from S3 via the s3 table function into a staging table, and swap partitions. Real-time pipelines use Flink to deserialize Kafka and Kinesis events, resolving nested protobuf messages at runtime with Java reflection so ClickHouse schemas no longer need manual syncing. Migration friction included unavailable features such as the Join engine (replaced by dictionaries) and the Kafka table engine, plus batch-size and data-freshness tuning.

  • 7 Tips For Optimizing Apache Flink Applications

    Shopify Engineering mediumAdept

    Lessons from running large stateful Apache Flink jobs (up to 13 TB of state) on GKE with the RocksDB state backend and checkpoints on GCS. Disabling Kryo fallback and fixing the serialization failures it exposed, such as Scala BigDecimal and sealed-trait ADTs, raised throughput by 20%. Keying records by partition before the File Sink cut active buckets per Task Manager by 90% and ended heap OOMs, and local SSDs for RocksDB gave about a 10x processing speedup over NFS. Further tips cover separate config profiles for backfill and steady state (partitions, network buffers, checkpoint intervals), avoiding dynamic classloading to stop Metaspace leaks on restart, and profiling with async-profiler, VisualVM, jemalloc/jeprof and Eclipse MAT.

  • How we tripled max concurrent jobs to boost performance of GitHub Actions

    GitHub Engineering mediumAdept

    GitHub Actions on GitHub Enterprise Server went from 2,200 to 7,000 max concurrent jobs on 96-core machines between GHES 3.2 and 3.6 through three main fixes. A hot path for workflow secrets and callback URLs had silently never used its cache, which only showed up in profile traces. Orchestration state moved from a single growing blob column to a per-event table with incremental reads and writes, cutting orchestration CPU by about 50%. Postback load to the Rails checks service was reduced by deferring step updates until run completion and removing duplicate completion events, with a message queue planned to replace the multi-hop HTTP delivery.

  • ClickHouse and The One Trillion Row Challenge

    ClickHouse mediumAdept

    ClickHouse answers Dask's One Trillion Row Challenge (min/avg/max temperature per station over 2.4TiB of Parquet in S3) in under 3 minutes for $0.56 by querying the data in place with the s3 function on an ephemeral cluster of AWS spot instances provisioned and torn down with Pulumi. ARM c7g.12xlarge instances were chosen on spot price per vCPU and availability, since the workload was CPU-bound rather than network-bound. Raising max_download_buffer_size to 50MB so each ~25MB file is fetched by a single thread cut S3 read wait, increased throughput to ~920MB/s and dropped a 111-billion-row test from 454s to 303s, with further thread tuning following. Loading the data into a MergeTree first would answer the query in 16 seconds, at the cost of load time.

The quest for software engineering knowledge.

Look:
Layout: