---
title: "Scaling Nextdoor’s Datastores: Part 3"
description: "Nextdoor replaced pickle-style byte serialization of Django ORM objects in its Redis/Valkey look-aside cache with MessagePack, so cache entries stay readable across code releases and schema migrations."
url: "https://swe.quest/articles/scaling-nextdoor-s-datastores-part-3-5cb25113d465521d"
canonical: "https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-3-e9b4dd8a9393"
source: "Nextdoor Engineering"
published: "2025-03-19"
difficulty: "medium"
kind: "Case study"
reading_minutes: 5
tags: ["caching","python","schema-migrations","databases"]
---

# Scaling Nextdoor’s Datastores: Part 3

A post on [Nextdoor Engineering](https://swe.quest/sources/nextdoor.md), published 2025-03-19, 5 min read, Case study. Original: [https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-3-e9b4dd8a9393](https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-3-e9b4dd8a9393)

## Summary

Nextdoor replaced pickle-style byte serialization of Django ORM objects in its Redis/Valkey look-aside cache with MessagePack, so cache entries stay readable across code releases and schema migrations. Pickled objects are tied to runtime and package versions; deserialization failures after a deploy or migration turn into mass cache misses and a thundering herd on the database. With MessagePack, older code ignores unknown new fields (forward compatibility) and newer code fills missing fields with required defaults (backward compatibility); field removals go through Django's SeparateDatabaseAndState. MessagePack was slower than pickle in isolation but had no noticeable effect on request latency, produced smaller payloads, and each value carries a 10-byte header (2-byte format metadata plus 8-byte object version) to support future changes such as compression.

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)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- Django ORM
- look-aside caching ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))
- Redis basics ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))

## Keywords

MessagePack, Django, pickle, Redis, Valkey, Nextdoor

## Related posts

- [Caching Without Marshal Part 2: The Path to MessagePack](https://swe.quest/articles/caching-without-marshal-part-2-the-path-to-messagepack-dde2d14188f0b673.md): Shopify Engineering · 2022-11-15 · Medium · 17 min read · Ruby, Caching, Refactoring & migrations
  Shopify replaced Ruby's Marshal with MessagePack as the Rails cache format for its core monolith so that code changes would stop breaking cached payloads on deploy.
- [Faster schema changes for large SQLite databases](https://swe.quest/articles/faster-schema-changes-for-large-sqlite-databases-4f28e48522ae95e1.md): Turso · 2025-09-02 · Medium · 3 min read · SQLite, Schema migrations, Performance engineering, Rust, Storage engines
  SQLite re-parses the entire sqlite\_schema table after every ALTER TABLE, so schema changes cost time proportional to total schema size even when only one table is touched.
- [Scaling Nextdoor’s Datastores: Part 5](https://swe.quest/articles/scaling-nextdoor-s-datastores-part-5-9c2a55c33ba04857.md): Nextdoor Engineering · 2025-03-19 · Medium · 8 min read · Caching, Consistency models, Event-driven architecture, PostgreSQL, Scaling
  Nextdoor closes cache consistency gaps in its look-aside Redis cache by consuming the PostgreSQL change data stream and issuing version-conditional del\_if\_version deletes whenever writers fail to update the cache.
- [Tulip: Schematizing Meta’s data platform](https://swe.quest/articles/tulip-schematizing-meta-s-data-platform-725b7402ef7a8468.md): Meta Engineering · 2022-11-09 · Medium · 6 min read · Schema migrations, Data pipelines, Queues & messaging, Performance engineering
  Tulip is Meta's binary serialization protocol for analytics logging, built on Thrift's TCompactProtocol.
- [Tracing Cache Inconsistencies to Their Root Cause](https://swe.quest/articles/tracing-cache-inconsistencies-to-their-root-cause-0cc21b10b814cb9e.md): Nextdoor Engineering · 2026-11-23 · Medium · 7 min read · Caching, Consistency models, Observability, PostgreSQL, Debugging
  Nextdoor extended its versioned Valkey ORM cache so every conditional write also atomically stores a short-lived verification key (receipt) recording the operation (fill\_on\_write or fill\_on\_miss), writer service, trace ID and replaced version, colocated via a hash tag in the same cluster slot.

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)
