---
title: "Using Server Sent Events to Simplify Real-time Streaming at Scale"
description: "Shopify replaced its 2021 BFCM Live Map delivery path, in which WebSocket fed a presentation layer that clients polled through a mailbox system every 10+ seconds, with a Go Server Sent Events server."
url: "https://swe.quest/articles/using-server-sent-events-to-simplify-real-time-streaming-at-scale-27a5424d07541ac7"
canonical: "https://shopify.engineering/server-sent-events-data-streaming"
source: "Shopify Engineering"
published: "2022-11-30"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["realtime","stream-processing","go","scalability","load-balancing"]
---

# Using Server Sent Events to Simplify Real-time Streaming at Scale

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2022-11-30, 9 min read, Case study. Original: [https://shopify.engineering/server-sent-events-data-streaming](https://shopify.engineering/server-sent-events-data-streaming)

## Summary

Shopify replaced its 2021 BFCM Live Map delivery path, in which WebSocket fed a presentation layer that clients polled through a mailbox system every 10+ seconds, with a Go Server Sent Events server. The server subscribes to Kafka topics produced by a Flink pipeline and pushes data straight to registered clients. SSE fit because the visualization only needs one-way, read-only push over plain HTTP with built-in reconnection; the server scales horizontally behind NGINX load balancers, and per-pod connection limits were sized with a Java load tester built on okhttp-eventsource. During BFCM 2022 the system had 100% uptime, SSE delivered data within milliseconds of availability, and end-to-end latency from event creation to display was about 21 seconds.

Written by swe.quest, not by the author.

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

## Topics

- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)
- [Stream processing](https://swe.quest/tags/stream-processing.md) (Data & databases)
- [Go](https://swe.quest/tags/go.md) (Languages)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Load balancing](https://swe.quest/tags/load-balancing.md) (Infrastructure)

## Prerequisites

- HTTP basics
- Kafka topics ([easy posts on Queues & messaging](https://swe.quest/tags/messaging.md?difficulty=easy))
- WebSocket vs polling models

## Keywords

Server Sent Events, EventSource, Apache Flink, Apache Kafka, NGINX, okhttp-eventsource, BFCM Live Map, Trickle

## Related posts

- [Scaling Shopify's BFCM Live Map: An Apache Flink Redesign](https://swe.quest/articles/scaling-shopify-s-bfcm-live-map-an-apache-flink-redesign-bcbe156fa7990bd0.md): Shopify Engineering · 2021-12-10 · Medium · 9 min read · Stream processing, Scaling, System design, Real-time systems
  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.
- [Web Streams at the Edge](https://swe.quest/articles/web-streams-at-the-edge-9c3ab22babd10448.md): Deno · 2021-11-30 · Medium · 3 min read · JavaScript, Serverless, Real-time systems, TypeScript
  Deno Deploy supports the Web Streams standard, so a streaming, event-driven HTTP server can be written in a few lines of TypeScript.
- [Streaming Real-Time Visualizations with ClickHouse, Apache Arrow and Perspective](https://swe.quest/articles/streaming-real-time-visualizations-with-clickhouse-apache-arrow-and-perspective-7d2ccb1a3cd92435.md): ClickHouse · 2024-10-02 · Medium · 13 min read · Analytics & OLAP, Frontend, Real-time systems, SQL, WebAssembly
  A ~100-line browser demo streams forex tick data from ClickHouse into the Perspective visualization library (Rust/C++ compiled to WebAssembly) using Apache Arrow over HTTP.
- [GraphQL, meet LiveGraph: a real-time data system at scale](https://swe.quest/articles/graphql-meet-livegraph-a-real-time-data-system-at-scale-0852462beb79152e.md): Figma · 2021-10-14 · Medium · 11 min read · Real-time systems, GraphQL, PostgreSQL, System design, Event-driven architecture
  LiveGraph is Figma's real-time data layer on Postgres: frontend code declares GraphQL-like live queries via a React useSubscription hook, and the server keeps results updated by tailing the Postgres write-ahead log distributed over Kafka instead of polling.
- [Leveraging Go Worker Pools to Scale Server-side Data Sharing](https://swe.quest/articles/leveraging-go-worker-pools-to-scale-server-side-data-sharing-5ace4b0b544c8996.md): Shopify Engineering · 2022-09-09 · Medium · 7 min read · Go, Concurrency, Performance engineering, Queues & messaging, Scaling
  Shopify's Server Pixels service, a Go pipeline that consumes over a billion customer events per day from Kafka, fell behind on consumer lag because it spawned an unbounded number of goroutines to process and produce event batches.

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)
