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

Building a Real-time Buyer Signal Data Pipeline for Shopify Inbox

Shopify built a streaming pipeline on Apache Beam and Google Cloud Dataflow that surfaces cart actions and order completions to merchants inside Shopify Inbox conversations. Kafka inputs (Monorail and Debezium CDC from MySQL) are filtered, keyed by buyer token with CoGroupByKey, and aggregated in a Global Window. Stateful processing compares timestamps to drop out-of-order events, derives cart actions from quantity changes, clears cart state on checkout, and uses event-time timers to expire state. In an A/B test, merchant response rate rose 2 percentage points and conversation conversion rate rose 0.7 points, with no change in response time.

Related posts

  • How Shopify Built An In-Context Analytics Experience

    Shopify Engineering mediumAdept

    Shopify embedded order and fulfillment metrics directly into the admin Orders page instead of keeping them in a separate Analytics section, after research showed merchants bouncing between pages to make decisions. The data science team validated candidate metrics against merchant workflows, segmented merchants to study the shape of each metric (hiding metrics that are inapplicable, constant, or only useful over long periods), and prototyped visualizations with real data. One result was choosing histograms over medians for fulfillment and delivery times. A shared data specification sheet kept Web, Android and iOS on the same queries. The underlying model uses an atomic grain of one row per fulfillment, in-transit or delivery event, and was built batch-first, then combined with streaming in a lambda architecture so batch supplies history and streaming covers recent data.

  • From batch processing to streaming: AMP’s data journey from open-source to ClickHouse Cloud

    ClickHouse mediumAdept

    AMP, a Shopify analytics platform, replaced a brittle twice-daily Postgres-to-ClickHouse batch sync, which routinely left data 30 to 72 hours stale and needed a 1.2 TB RAM server, with a streaming pipeline into ClickHouse Cloud. Shopify webhooks flow through Amazon EventBridge and Lambda into ReplacingMergeTree tables, which deduplicate updates. To avoid the cost of small inserts, Kinesis Data Firehose buffers events to S3 and asynchronous inserts are enabled, since ClickHouse performs best with batches of at least 1,000 rows. Environments are provisioned reproducibly with the ClickHouse Cloud Terraform provider.

  • How Shopify improved consumer search intent with real-time ML

    Shopify Engineering mediumAdept

    Shopify generates about 2,500 text and image embeddings per second (216M/day) in near real time with Google Cloud Dataflow and Apache Beam's RunInference on T4 GPUs, feeding Storefront Semantic Search and a BigQuery warehouse. Cutting Dataflow's per-process worker harness threads from 12 to 4 reduced memory use about 2.6x, from roughly 104GB to 40GB, without hurting GPU-bound throughput. That let the team drop high-memory machines and save 14% in cost. Sharing one model across processes and forcing a single SDK container both hurt throughput too much. Bursty input produced bundles of one element, so in-bundle batching rarely formed real batches, but stateful cross-bundle batching added unacceptable shuffle latency; per-process model copies still keep the GPU saturated.

  • Scaling Shopify's BFCM Live Map: An Apache Flink Redesign

    Shopify Engineering mediumAdept

    Shopify scaled its Black Friday/Cyber Monday live sales map by putting Apache Flink in front of Cricket, its home-grown Go stateful streaming service. Flink filtered the checkout Kafka stream so Cricket processed only about one percent of the events, and Flink also computed new metrics such as product trends and unique shoppers. The Flink jobs used cross-region sharding and active-active deployment, handled load tests of 1M events/sec and ran with 100% uptime through BFCM, with Spark batch jobs as a fallback. Redis used for broadcasting to browsers still became a bottleneck and briefly clogged in production, so the planned redesign moves all metrics into Flink and snapshots them to a store that a web tier serves from an in-memory cache.

  • Real-time event streaming with ClickHouse, Confluent Cloud and ClickPipes

    ClickHouse mediumAdept

    ClickPipes, a managed Kafka ingestion service in ClickHouse Cloud, replaces the ClickHouse Kafka Connector in a pipeline that streams Google's public Ethereum dataset from Pub/Sub through Confluent Cloud into ClickHouse. The pipeline evolved from a batch BigQuery-to-GCS export with about 30 minutes of delay, to a Pub/Sub-to-Kafka stream about 4 minutes behind the chain, and now ClickHouse pulls directly from the Kafka topics. One ClickPipe per topic lands raw JSON into message tables, and materialized views using JSONExtract populate typed MergeTree tables. Configuration tips cover using the Confluent API key as credentials, setting a unique consumer group and supplying the bootstrap endpoint.

The quest for software engineering knowledge.

Look:
Layout: