---
title: "Scaling Nextdoor’s Datastores: Part 5"
description: "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."
url: "https://swe.quest/articles/scaling-nextdoor-s-datastores-part-5-9c2a55c33ba04857"
canonical: "https://engblog.nextdoor.com/scaling-nextdoors-datastores-part-5-5221da60f374"
source: "Nextdoor Engineering"
published: "2025-03-19"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["caching","consistency","event-driven","postgres","scalability"]
---

# Scaling Nextdoor’s Datastores: Part 5

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

## Summary

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. Because deletes are guarded by row versions, changes can be processed out of order and horizontally scaled. A race between cache fills on read misses and missed writes is handled with two reconcilers: one near-real-time, and one delayed slightly beyond the web request timeout to mop up stale refills. The pipeline is pg-bifrost republishing the WAL into Kafka, with a Go consumer that uses a time wheel for the delayed pass.

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)
- [Consistency models](https://swe.quest/tags/consistency.md) (Distributed systems)
- [Event-driven architecture](https://swe.quest/tags/event-driven.md) (Backend & APIs)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)

## Prerequisites

- look-aside caching ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))
- change data capture
- row versioning for cache writes ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))
- Kafka consumers ([easy posts on Queues & messaging](https://swe.quest/tags/messaging.md?difficulty=easy))

## Keywords

Redis, PostgreSQL WAL, pg-bifrost, Kafka, del\_if\_version, Nextdoor

## Related posts

- [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.
- [Everyone gets faster writes: We turned off FPW's in Neon](https://swe.quest/articles/everyone-gets-faster-writes-we-turned-off-fpw-s-in-neon-60d0cd25f29077e7.md): Neon · 2026-05-07 · Hard · 7 min read · PostgreSQL, Storage engines, Performance engineering, Distributed databases
  Neon disabled Postgres full-page writes fleet-wide because its stateless compute streams WAL to a Paxos safekeeper quorum and has no local disk pages that can tear.
- [Fan-out from Postgres with Change Data Capture using Debezium and Upstash Redis](https://swe.quest/articles/fan-out-from-postgres-with-change-data-capture-using-debezium-and-upstash-redis-1afcb52ed56a9566.md): Neon · 2024-02-14 · Medium · 9 min read · Event-driven architecture, PostgreSQL, Queues & messaging, Replication
  Streaming committed Postgres changes from the write-ahead log via a logical replication slot avoids the dual-write problem, where an application writes to the database and a message broker separately and can leave them inconsistent.
- [Eventually Consistent: How Do We Know the Systems Eventually Agree?](https://swe.quest/articles/eventually-consistent-how-do-we-know-the-systems-eventually-agree-446e4800453d4b35.md): Kogan.com Dev Blog · 2026-11-09 · Medium · 9 min read · Event-driven architecture, Consistency models, Resilience, PostgreSQL, E-commerce
  Eventually consistent event-driven order systems need a reconciliation job that starts from the authoritative order store, not from received messages, so orders whose events were lost (like a fraud-hold release that never reached SAP) still surface.
- [Keeping it 100(x) with real-time data at scale](https://swe.quest/articles/keeping-it-100-x-with-real-time-data-at-scale-3b49e279c5a600f2.md): Figma · 2024-05-17 · Medium · 19 min read · Caching, Real-time systems, Scaling, PostgreSQL, System design
  Figma rebuilt LiveGraph, its real-time GraphQL-like subscription service over Postgres, to scale reads and database update load 100x as the database moved from one instance to vertical and horizontal shards.

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)
