Skip to content

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

Canva Engineering 9 min read Case study mediumAdept

Session revocations at scale

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.

Related posts

  • Evolving the Backend Storage for Platform Metrics

    Heroku Engineering mediumAdept

    Heroku migrated the time-series store behind MetaaS, its internal metrics service, from self-managed Apache Cassandra to AWS DynamoDB without user-visible impact. MetaaS ingests a couple hundred thousand observations per second into Kafka and aggregates them with stream-processing jobs, writing tens of thousands of points per second to the database. The migration used parallel dual-writes from Kafka and GitHub Scientist-style shadow reads, ramped to 100% of traffic, to catch edge cases. TTL-based retention meant no data backfill was needed: they waited for old Cassandra data to expire, then incrementally cut reads over. p99 query latency dropped from a variable 20–80 ms to a steady 15 ms, and costs fell.

  • Why We Built a Write Back Cache for Our Asset Library with Google Cloud Spanner

    Squarespace Engineering mediumAdept

    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. Synchronous GCS writes caused long-tail latency and hit GCS's one-write-per-second-per-object limit, which forced fragile write-coalescing logic. Updates now land in Spanner, are applied when libraries load into the in-memory cache, and are flushed to GCS asynchronously. A write-ahead log and per-library queues were rejected because only end state is needed and libraries are scoped individually. After a canary rollout, average write latency fell to about 30% and p99 to about 10% of previous levels.

  • Petsem: Sometimes Dead Is Better

    Fly.io mediumAdept

    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. The change cut p99 secret-load time on app boot from 10s to 300ms and removed a single-region dependency, avoiding an enterprise multi-region Vault license costing roughly an engineer's salary per year. Macaroon third-party discharge tokens restrict secret reads to workers actually hosting the app, so a compromised host can only reach secrets for apps placed on it, and denied reads trigger alerts. The migration ran dual-write and side-by-side from 2024 to a July 2025 cutover, and Fly KMS builds on Petsem to offer encrypt, decrypt, sign and verify operations without the secret ever leaving the store.

  • Inside GitHub’s new Git storage architecture

    GitHub Engineering hardMaster

    GitHub's new Git storage architecture, Rubicon, rests on one observation: only reference updates need ordering. Git objects go to Azure Blob Storage, and refs plus the pack manifest go to a small quorum-replicated compare-and-swap log called Ref-CAS. Disposable virtual replicas serve reads and writes from a rebuildable cache, while separate lease-based compaction nodes merge packs in the background, so storage, serving and maintenance scale independently. Ref-CAS replaced blob-based ref logs, which topped out at the mid-hundreds of writes per second or traded away read latency. It reaches tens of thousands of ref operations per second, and internal tests sustained 7,200 pushes per second from 5,000 concurrent agents on one repository.

  • Litestream Revamped: SQLite Replication

    Fly.io mediumAdept

    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. Conditional writes in S3 and Tigris provide a time-based lease that guarantees a single writer per destination without Consul, which removes the need for multiple "generations" and makes failover and replica resync simpler. Planned additions are a VFS-based read-replica layer that fetches and caches pages straight from object storage, and wildcard replication of hundreds or thousands of databases from one process.

The quest for software engineering knowledge.

Look:
Layout: