---
title: "Shopify's Path to a Faster Trino Query Execution: Infrastructure"
description: "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."
url: "https://swe.quest/articles/shopify-s-path-to-a-faster-trino-query-execution-infrastructure-049ef695613ce2a3"
canonical: "https://shopify.engineering/faster-trino-query-execution-infrastructure"
source: "Shopify Engineering"
published: "2021-07-09"
difficulty: "medium"
kind: "Case study"
reading_minutes: 12
tags: ["query-engines","performance","analytics","jvm","kubernetes"]
---

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

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2021-07-09, 12 min read, Case study. Original: [https://shopify.engineering/faster-trino-query-execution-infrastructure](https://shopify.engineering/faster-trino-query-execution-infrastructure)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Query engines](https://swe.quest/tags/query-engines.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)
- [Kubernetes](https://swe.quest/tags/kubernetes.md) (Infrastructure)

## Prerequisites

- distributed SQL query engines ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- JVM JIT basics ([easy posts on Java & JVM](https://swe.quest/tags/jvm.md?difficulty=easy))
- Kubernetes basics ([easy posts on Kubernetes](https://swe.quest/tags/kubernetes.md?difficulty=easy))

## Keywords

Trino, Trino Gateway, GKE, Datadog, jvisualvm, Airflow

## Related posts

- [Shopify's Path to a Faster Trino Query Execution: Custom Verification, Benchmarking, and Profiling Tooling](https://swe.quest/articles/shopify-s-path-to-a-faster-trino-query-execution-custom-verification-2b306664a492e288.md): Shopify Engineering · 2021-10-27 · Medium · 12 min read · Query engines, Testing, Performance engineering, Python, Deployment
  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.
- [How Lyft powers batch and real-time analytics with ClickHouse Cloud](https://swe.quest/articles/how-lyft-powers-batch-and-real-time-analytics-with-clickhouse-cloud-f74360c81abeeaab.md): ClickHouse · 2025-09-10 · Medium · 6 min read · Analytics & OLAP, Data pipelines, Stream processing, Databases
  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.
- [7 Tips For Optimizing Apache Flink Applications](https://swe.quest/articles/7-tips-for-optimizing-apache-flink-applications-be2dbc2fd7e74cd5.md): Shopify Engineering · 2022-03-08 · Medium · 14 min read · Stream processing, Performance engineering, Java & JVM, Debugging
  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.
- [How we tripled max concurrent jobs to boost performance of GitHub Actions](https://swe.quest/articles/how-we-tripled-max-concurrent-jobs-to-boost-performance-of-github-actions-9d54244cd033cdac.md): GitHub Engineering · 2022-09-16 · Medium · 5 min read · Performance engineering, Scaling, CI/CD, Caching
  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.
- [ClickHouse and The One Trillion Row Challenge](https://swe.quest/articles/clickhouse-and-the-one-trillion-row-challenge-6f10fe80ade607d9.md): ClickHouse · 2024-03-05 · Medium · 17 min read · Analytics & OLAP, Performance engineering, Cost optimization, Cloud platforms, Query engines
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
