---
title: "Why We Built a Write Back Cache for Our Asset Library with Google Cloud Spanner"
description: "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."
url: "https://swe.quest/articles/why-we-built-a-write-back-cache-for-our-asset-library-with-google-cloud-spanner-916cbe4f50b5d115"
canonical: "https://engineering.squarespace.com/blog/2024/why-we-built-a-write-back-cache-for-our-asset-library-with-google-cloud-spanner"
source: "Squarespace Engineering"
published: "2024-03-21"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["caching","system-design","cloud","performance","storage-systems"]
---

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

A post on [Squarespace Engineering](https://swe.quest/sources/squarespace.md), published 2024-03-21, 6 min read, Case study. Original: [https://engineering.squarespace.com/blog/2024/why-we-built-a-write-back-cache-for-our-asset-library-with-google-cloud-spanner](https://engineering.squarespace.com/blog/2024/why-we-built-a-write-back-cache-for-our-asset-library-with-google-cloud-spanner)

## Summary

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.

Written by swe.quest, not by the author.

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

## Topics

- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Storage systems](https://swe.quest/tags/storage-systems.md) (Infrastructure)

## Prerequisites

- object storage basics ([easy posts on Storage systems](https://swe.quest/tags/storage-systems.md?difficulty=easy))
- caching concepts ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))

## Keywords

Google Cloud Spanner, Google Cloud Storage, Alexandria, write-back cache, Squarespace

## Related posts

- [Session revocations at scale](https://swe.quest/articles/session-revocations-at-scale-0e845eb64b268c30.md): Canva Engineering · 2026-07-22 · Medium · 9 min read · Identity & auth, Caching, Scaling, System design, Storage systems
  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.
- [How does Turso Cloud keep your data durable and safe?](https://swe.quest/articles/how-does-turso-cloud-keep-your-data-durable-and-safe-676876baa112a2af.md): Turso · 2025-05-20 · Medium · 4 min read · SQLite, Storage engines, Storage systems, Multi-tenancy, Cloud platforms
  Turso Cloud makes every SQLite database durable on S3 and S3 Express, treating local server disk purely as a cache.
- [Turso Cloud on AWS is now available for everybody](https://swe.quest/articles/turso-cloud-on-aws-is-now-available-for-everybody-1dc0ea860495bbb1.md): Turso · 2025-03-17 · Easy · 2 min read · SQLite, Storage engines, Multi-tenancy, Cloud platforms, Serverless
  Turso Cloud is now generally available on AWS, built on an S3-native architecture where every commit is made durable on S3 Express One Zone and local disks serve as a read cache.
- [The bridge to agent-scale Git infrastructure](https://swe.quest/articles/the-bridge-to-agent-scale-git-infrastructure-d844fd2db4fef4f7.md): GitHub Engineering · 2026-10-21 · Medium · 7 min read · Replication, Distributed systems, Scaling, Version control, Storage systems
  GitHub has moved nearly all Git repositories to replicas split between its own data centers and Azure.
- [Turso Cloud Goes Diskless: How We Built a Fully S3-Based Database Architecture](https://swe.quest/articles/turso-cloud-goes-diskless-how-we-built-a-fully-s3-based-database-architecture-83acec3912831a26.md): Turso · 2025-04-07 · Medium · 10 min read · Storage systems, Cloud platforms, SQLite, Multi-tenancy, Cost optimization
  Turso Cloud moved to a diskless architecture where writes are acknowledged only after landing in S3 Express One Zone, so compute pods hold no durable local state and can be rescheduled freely.

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)
