---
title: "A Deep Dive into PolyScale’s Architecture"
description: "PolyScale is a wire-protocol proxy cache that sits between an application and its database (here, Neon serverless Postgres), routing connections to the nearest edge PoP and caching query results with TTLs it learns automatically from arrival rate, result change rate and related \"query templates\"."
url: "https://swe.quest/articles/a-deep-dive-into-polyscale-s-architecture-4fc7b2915489e809"
canonical: "https://neon.com/blog/title-a-deep-dive-into-polyscales-architecture"
source: "Neon"
published: "2023-12-18"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 11
tags: ["caching","postgres","cdn-edge","performance"]
---

# A Deep Dive into PolyScale’s Architecture

A post on [Neon](https://swe.quest/sources/neon.md), published 2023-12-18, 11 min read, Deep dive. Original: [https://neon.com/blog/title-a-deep-dive-into-polyscales-architecture](https://neon.com/blog/title-a-deep-dive-into-polyscales-architecture)

## Summary

PolyScale is a wire-protocol proxy cache that sits between an application and its database (here, Neon serverless Postgres), routing connections to the nearest edge PoP and caching query results with TTLs it learns automatically from arrival rate, result change rate and related "query templates". Typically a cache hit happens by the 2nd or 3rd query. Invalidation works in three layers: row-level SQL parsing of writes with global invalidation messages to all PoPs, a table-level fallback for complex queries, and detection of unexplained result changes that disables caching for affected queries, giving eventual consistency without reading the WAL. A built-in performance test shows cached responses around 1ms versus 90–515ms direct to the origin.

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)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [CDN & edge](https://swe.quest/tags/cdn-edge.md) (Infrastructure)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- SQL query basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- database caching and TTLs ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- database connection strings ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

PolyScale, Neon, Smart Invalidation, PostgreSQL

## Related posts

- [Lakebase Postgres is built on object storage, but 99.99999% of reads never touch it](https://swe.quest/articles/lakebase-postgres-is-built-on-object-storage-but-99-99999-of-reads-never-touch-66e3f7227042e0f9.md): Neon · 2026-11-05 · Medium · 7 min read · PostgreSQL, Storage engines, Caching, Storage systems, Performance engineering
  Lakebase Postgres stores durable history in object storage but keeps it off the read path through tiered caching.
- [Separation of storage and compute without a performance tradeoff](https://swe.quest/articles/separation-of-storage-and-compute-without-a-performance-tradeoff-25a1b45d403d8baf.md): Neon · 2025-07-11 · Easy · 6 min read · PostgreSQL, Caching, Performance engineering, Serverless, Storage systems
  Neon's Local File Cache (LFC) sits between Postgres shared buffers and Neon's remote multi-tenant page storage.
- [Cache made consistent](https://swe.quest/articles/cache-made-consistent-61a6d7479b73ae8d.md): Meta Engineering · 2022-06-08 · Medium · 13 min read · Caching, Consistency models, Observability, Distributed systems, Debugging
  Meta raised TAO's cache consistency from six nines to ten nines (99.99999999% of cache writes consistent within five minutes) by treating consistency as a measurement and debugging problem rather than only a protocol problem.
- [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.
- [Distributing Global State to Serve over 1 Billion Daily Requests](https://swe.quest/articles/distributing-global-state-to-serve-over-1-billion-daily-requests-65554ed0d12e6461.md): Render · 2024-05-23 · Medium · 11 min read · Caching, Scaling, PostgreSQL, Load balancing, System design
  Render's request routers evolved from per-instance in-memory caches with 5-minute TTLs and database lookups on miss, which overloaded PostgreSQL on every redeploy and failed during database downtime, to push-based caching using PostgreSQL LISTEN/NOTIFY so routers never query the database in the hot path.

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)
