---
title: "Session revocations at scale"
description: "Canva moved its gateway session-revocation cache from per-pod MySQL loads to sorted binary chunks in S3, eliminating the database stampede when hundreds of gateway pods started during deploys."
url: "https://swe.quest/articles/session-revocations-at-scale-0e845eb64b268c30"
canonical: "https://www.canva.dev/blog/engineering/session-revocations-at-scale/"
source: "Canva Engineering"
published: "2026-07-22"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["identity-auth","caching","scalability","system-design","storage-systems"]
---

# Session revocations at scale

A post on [Canva Engineering](https://swe.quest/sources/canva.md), published 2026-07-22, 9 min read, Case study. Original: [https://www.canva.dev/blog/engineering/session-revocations-at-scale/](https://www.canva.dev/blog/engineering/session-revocations-at-scale/)

## Summary

Canva moved its gateway session-revocation cache from per-pod MySQL loads to sorted binary chunks in S3, eliminating the database stampede when hundreds of gateway pods started during deploys. Revocations are packed into 16-byte records in sorted flat arrays split into 30-minute S3 objects. Gateways binary-search the downloaded bytes directly and refresh recent chunks with conditional GETs. A ZooKeeper-elected worker appends new revocations, using conditional PUTs for optimistic concurrency so that racing writers never lose updates. The theoretically O(N^2) rebuild still exceeds 2000 revocations/sec, memory use dropped 87.5%, and read replicas were cut to two.

Written by swe.quest, not by the author.

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

## Topics

- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)
- [Storage systems](https://swe.quest/tags/storage-systems.md) (Infrastructure)

## Prerequisites

- session cookies
- S3 object storage ([easy posts on Storage systems](https://swe.quest/tags/storage-systems.md?difficulty=easy))
- optimistic concurrency control ([easy posts on Concurrency](https://swe.quest/tags/concurrency.md?difficulty=easy))
- binary search ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))

## Keywords

Amazon S3, MySQL, ZooKeeper, Redis, conditional PUT, Canva

## Related posts

- [Evolving the Backend Storage for Platform Metrics](https://swe.quest/articles/evolving-the-backend-storage-for-platform-metrics-0fb82a7939c98396.md): Heroku Engineering · 2024-05-09 · Medium · 6 min read · Databases, Distributed databases, Observability, Cloud platforms, Schema migrations
  Heroku migrated the time-series store behind MetaaS, its internal metrics service, from self-managed Apache Cassandra to AWS DynamoDB without user-visible impact.
- [Why We Built a Write Back Cache for Our Asset Library with Google Cloud Spanner](https://swe.quest/articles/why-we-built-a-write-back-cache-for-our-asset-library-with-google-cloud-spanner-916cbe4f50b5d115.md): Squarespace Engineering · 2024-03-21 · Medium · 6 min read · Caching, System design, Cloud platforms, Performance engineering, Storage systems
  Squarespace's Alexandria asset-library service moved write latency off the critical path by adding a Google Cloud Spanner write-back cache in front of Google Cloud Storage, where libraries are stored as header, segment and trash objects.
- [Petsem: Sometimes Dead Is Better](https://swe.quest/articles/petsem-sometimes-dead-is-better-1fcc24cdcd7724b3.md): Fly.io · 2026-11-20 · Medium · 6 min read · Security, Identity & auth, Replication, System design, Cloud platforms
  Fly.io replaced HashiCorp Vault with Petsem, a home-grown secrets store that keeps a single write master in IAD but adds regional read replicas, trading strict consistency for availability.
- [Inside GitHub’s new Git storage architecture](https://swe.quest/articles/inside-github-s-new-git-storage-architecture-014a8644555e81c8.md): GitHub Engineering · 2026-11-05 · Hard · 15 min read · Version control, Storage systems, Distributed systems, Scaling, Replication
  GitHub's new Git storage architecture, Rubicon, rests on one observation: only reference updates need ordering.
- [Litestream Revamped: SQLite Replication](https://swe.quest/articles/litestream-revamped-sqlite-replication-0708888533a47bfa.md): Fly.io · 2025-05-20 · Medium · 6 min read · SQLite, Replication, Storage engines, Storage systems
  Litestream is being reworked around ideas from LiteFS. It replaces the raw-WAL "shadow WAL" with transaction-aware LTX files, sorted page changesets that can be compacted LSM-style, so point-in-time restores no longer replay every intermediate page write.

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)
