Postgres is half as fast in Linux 7.0, and we always knew why
Summary
An Amazon engineer, U Salvatore from Amazon Italia, discovered a significant 50% performance regression in Postgres 18 when tested with the upcoming Linux kernel 7.0, specifically on April 3rd, 2026. This slowdown stems from Linux 7.0's new default "preempt lazy" kernel preemption mode, which allows kernel code to be preempted more readily than the previous "preempt none" default. Postgres's process-based architecture, which relies on spin locks to protect shared buffers, experiences a high volume of page faults due to lazy page table population for each connection. Under "preempt lazy", a process holding a spin lock can be preempted during a page fault, leaving other processes to spin-wait, drastically reducing throughput. A configuration workaround involves enabling Huge Pages (2MB instead of 4KB) to reduce the frequency of page faults, effectively resolving the immediate performance drop. The underlying issue highlights Postgres's process-based design versus a thread-based approach.
Key takeaway
For DevOps Engineers or Database Administrators deploying Postgres on Linux kernel 7.0, you must enable Huge Pages to prevent a 50% performance regression. The new "preempt lazy" kernel default, combined with Postgres's process-based architecture, causes severe spin lock contention during page faults. Configuring Huge Pages (2MB) is a critical workaround to maintain expected throughput. You should also consider the long-term implications of process-based database designs on modern kernel behaviors.
Key insights
Linux kernel's "preempt lazy" default exposed Postgres's process-based architecture vulnerability to page fault-induced spin lock contention.
Principles
- Kernel preemption settings directly influence database performance.
- Process-per-connection models with shared memory can incur high page fault overhead.
- Spin locks are susceptible to preemption during kernel-mode operations.
Method
Troubleshooting involved recompiling the kernel commit-by-commit to isolate the regression's source.
In practice
- Configure Huge Pages (2MB) for Postgres on Linux 7.0 to mitigate performance regressions.
- Evaluate database architecture for process vs. thread models regarding shared memory and page table efficiency.
Topics
- Postgres
- Linux Kernel 7.0
- Performance Regression
- Kernel Preemption
- Huge Pages
- Database Architecture
Best for: CTO, VP of Engineering/Data, Software Engineer, Data Engineer, DevOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Hussein Nasser.