Skip to content

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

Shopify Engineering 6 min read Case study easyNovice

How We Enable Two-Day Delivery in the Shopify Fulfillment Network

Shopify Fulfillment Network shows two-day delivery dates by precomputing them rather than calculating them at request time. Each third-party logistics provider uploads its own delivery dates through new GraphQL platform APIs, which keeps the core platform from forcing fine-grained primitives on every provider. SFN builds its dates from inventory proximity, carrier restrictions on heavy or hazardous goods, warehouse calendars and capacity, and carrier pickup times, capacity and transit days. To cut data volume, SKUs that share fulfillment centers and physical traits map to shared schedules, so a delivery date lookup at checkout takes under 100 ms and the promised date later guides order routing.

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.

  • How we prepare Shopify for BFCM

    Shopify Engineering mediumAdept

    Shopify readies for Black Friday Cyber Monday with a year-long program that runs from March to October. It combines capacity planning on Google Cloud, What Could Go Wrong risk assessments, chaos-engineering Game Days on critical journeys like checkout, and a centralized Resiliency Matrix of failure modes, RTOs and runbooks. Five scale tests at forecast and p99 load (up to 200M requests per minute) used the Genghis load generator from three GCP regions, Toxiproxy fault injection and regional failovers. The tests surfaced issues such as checkout queue backups, rate-limit paths in authenticated checkout and slow region rebalancing. The newly rebuilt analytics platform needed more Kafka partitions, API memory optimization, connection-timeout tuning and load-balancer changes before facing its first holiday peak.

  • How to Reliably Scale Your Data Platform for High Volumes

    Shopify Engineering mediumAdept

    Shopify's Data Platform Engineering team prepared Tier 1 and Tier 2 ingestion and query services for a forecast near-doubling of BFCM 2020 traffic with a five-step reliability process. The steps were to define each service's primary objective (a freshness SLO for the Longboat batch ingester, a latency SLO for Reportify), identify tunable knobs such as job frequency, overlap interval, GKE CPU/memory, BigTable node pools and ProxySQL pools, and constrain those knobs to simulate N-times load. Teams then validated that every alert was actionable with simple runbooks and decided where to scale or tune. The exercise led to cluster scale-ups and job and query tuning, and BFCM ran with a 150% throughput increase and only minor self-healing incidents.

  • Rate Limiting GraphQL APIs by Calculating Query Complexity

    Shopify Engineering mediumAdept

    Shopify's GraphQL Admin API rate-limits by calculated query cost instead of request count: clients get 50 points per second up to a 1,000-point bucket, and each query is priced by static analysis before execution. Objects, interfaces and unions cost 1 point, and scalars and enums are free. Connections cost 2 plus the number of requested objects, and mutations cost 10 to reflect side effects. Responses report requested and actual cost in an extensions object, and any unused requested cost is refunded. Shopify found calculated cost correlates linearly with execution time, which makes server load predictable and rewards clients for requesting only the data they need.

  • Creating a Flexible Order Routing System with Shopify Functions

    Shopify Engineering mediumAdept

    Shopify rebuilt its order routing, which picks the inventory location an order ships from, around composable "routing rules". Each rule is a Shopify Function written in Rust and compiled to WebAssembly. Each rule takes a GraphQL-shaped input and independently ranks eligible locations, with 0 as best; default rules cover closest location, staying within the destination market, and merchant-ranked locations. A reducer applies the rules in the merchant's chosen order, using each later rule only to break ties among locations ranked best by earlier ones. Replacing a tightly coupled nested-loop algorithm with a pipeline pattern (prepare input, run rules, reduce, output) made the code easier to understand and debug.

The quest for software engineering knowledge.

Look:
Layout: