Skip to content

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

Canva Engineering 14 min read Case study mediumAdept

Lessons learnt from building reactive microservices for Canva Live - Canva Engineering Blog

Canva Live delivers near real-time audience questions to presenters through a hybrid design: presenters receive updates over WebSockets, while audience members use plain request/response APIs, all behind a gateway that multiplexes client sockets onto single connections per RPC node and uses service discovery instead of an ALB. Redis on ElastiCache in cluster mode is the datastore, accessed via the lettuce reactive Java client. Redis Streams carry per-session question events, polled with XRANGE and later moving to blocking XREAD, and a SortedSet with ZADD/ZCOUNT tracks participants active in the last 10 seconds. Practical lessons include building for scale from day one, pushing filtering into Redis data structures, using hash tags so transactional keys share a shard (Redis transactions don't roll back), and reserving streaming connections for chatty interactions.

Related posts

  • More Reliable Connections to Your Repls

    Replit mediumAdept

    Replit split reverse WebSocket proxying out of Conman, its container manager on GCE VMs, into a dedicated service called Eval that sits between clients and Conman VMs. Previously, frequent Conman rollouts could disconnect a client twice (once when the proxying VM died and again when the target VM died), complicated autoscaling, and blurred the cause of session failures. With Eval, Conman updates cause at most one disconnect, Eval drains connections with a 30h+ shutdown grace period, scales independently on active connections, and its observability pinpoints whether failures come from token validation, Controlplane lookups or the remote Conman connection.

  • Real-time Messaging

    Slack Engineering mediumAdept

    Slack's real-time messaging runs on four Java services: stateful in-memory Channel Servers sharded by consistent hashing, regionally deployed Gateway Servers holding websocket subscriptions, stateless Admin Servers bridging the Webapp backend, and Presence Servers tracking online users. Consistent hash ring managers (CHARMs) registered in Consul replace failed Channel Servers in under 20 seconds. Messages flow from Webapp to Admin Server to the owning Channel Server, which fans out to every subscribed Gateway Server worldwide. Transient events like typing indicators skip persistence and enter directly through the Gateway. The system delivers messages globally within 500ms and handles tens of millions of channels per host.

  • From Event-Driven Chaos to a Blazingly Fast Serving API

    Zalando Engineering mediumAdept

    Zalando replaced an event-driven pipeline that merged Product, Price and Stock events with a central Product Read API (PRAPI). During Cyber Week that pipeline delayed price and stock updates by up to 30 minutes, because over 90% of each payload was unchanged. PRAPI is a Caffeine async-loading cache over DynamoDB, run on Kubernetes with Netty/Epoll non-blocking I/O, and serves millions of requests per second at sub-10ms P99. Consistent hash load balancing in Skipper partitions the catalogue so small per-pod caches hold hot products. Fixed ring positions and a bounded-load cap of 2× the average keep caches warm during scaling and stop hyped products from overloading a pod. Tail latency came down by caching payloads as byte arrays to avoid GC pauses, using LIFO queuing, and splitting DynamoDB clients into a 10ms primary and a 100ms fallback. Adoption across ~350 teams worked because PRAPI served the legacy formats via the Accept header, and the org was restructured along CQRS lines.

  • 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.

  • Bringing serverless functions closer to the speed of wire

    Modal mediumAdept

    Modal rebuilt its serverless I/O plane, which queues Function inputs and outputs, and now runs it in at least four regions. A new `routing_region` flag lets callers avoid round trips to us-east, and the completed migration cut end-to-end Function Call latency by about 80ms at p50. The redesign moves non-critical work like autoscaling stats and dashboard events to the background and minimizes shared-storage access on the hot path, using client-side metadata caching and JWT-based auth. It also rewrites the server layer from async Python to Go to avoid event-loop lag, and stays on Redis 7.1 for its Redis-streams queues after load tests showed CPU spikes from 7.2 onward. Users are advised to route near their clients, keep payloads under 2MiB to skip blob-storage uploads, and batch small inputs.

The quest for software engineering knowledge.

Look:
Layout: