Engineering brief

Postgres is half as fast in Linux 7.0, and we always knew why

Hussein Nasser2 min read · saves 31 min

At a glance

Relevance
Practical value
Warnings
None

Linux 7.0's kernel preemption change halves Postgres speed, exposing a deep architectural tension between process-based DBs and modern kernels.

It reveals how upstream kernel changes can silently cripple production databases, demanding proactive testing and architectural awareness from platform and data teams.

Summary

An Amazon engineer discovered a 50% performance regression in Postgres running on the upcoming Linux kernel 7.0. The root cause is a Linux default change from 'preempt none' to 'preempt lazy' for kernel code. This means kernel operations like page faults can now be preemptively scheduled out. When a Postgres process holds a spinlock on shared memory and then triggers a page fault, it can now be preempted while holding that lock, causing all other waiting processes to spin uselessly. The workaround is enabling huge pages, which drastically reduces page fault frequency. But the fundamental design tension remains: Postgres uses a process-per-connection model, so every new backend inherits an empty page table. Under high connection counts, this generates massive, continuous page fault overhead that the new kernel default amplifies. The discussion is not about a bug but about how a legitimate kernel improvement for fairness interacts poorly with a decades-old database architecture choice. This is a case study in how infrastructure defaults can silently reshape application performance profiles, and why architectural assumptions must be re-evaluated as the layers beneath them evolve. The immediate fix is operational (enable huge pages). The deeper signal is the growing cost of process-based concurrency on modern Linux, and whether teams running Postgres at scale need to start planning for or advocating a thread-based architecture.

Watch the video

This video is blocked due to your privacy settings. To watch this video, please accept YouTube marketing cookies.

Related breakdowns

Get TL;DW

Too Long; Didn't Watch.

A concise breakdowns of the AI and devtools videos that actually matter for engineering leaders.

Free. Weekly. No hype.

Video and thumbnails remain the property of their respective creators. tldw.news provides editorial analysis, commentary, and discovery links to original content.