TL;DR
PostgreSQL has shifted to strict memory overcommit configurations to prevent the Linux Out-Of-Memory killer from terminating its processes. This move aims to improve database stability in memory-intensive environments.
PostgreSQL has officially adopted strict memory overcommit settings in its latest release, aiming to reduce the likelihood of the Linux Out-Of-Memory (OOM) killer terminating its processes. This change comes after ongoing concerns about stability and data integrity in memory-heavy deployments, highlighting a strategic shift to prioritize predictable memory management over aggressive overcommit policies.
The PostgreSQL community announced in March 2024 that it now recommends configuring Linux systems with strict overcommit settings to prevent the OOM killer from terminating database processes during high memory usage. This configuration change is confirmed by PostgreSQL maintainers and aligns with best practices for avoiding unexpected crashes in production environments.
Historically, many Linux systems used a more permissive overcommit policy, allowing processes to allocate more memory than physically available, which sometimes led to the OOM killer terminating critical services like PostgreSQL. The new approach enforces stricter limits, ensuring that memory allocations stay within physical bounds, thus reducing the risk of sudden process termination and data corruption.
Developers note that this change is particularly relevant for large-scale, memory-intensive deployments where stability is paramount. PostgreSQL recommends setting the kernel parameter vm.overcommit_memory to 2, which enforces strict overcommit policies, and adjusting vm.overcommit_ratio accordingly.
Impact of Strict Memory Settings on PostgreSQL Stability
This move is significant because it directly addresses a longstanding challenge in managing large PostgreSQL deployments on Linux systems. By adopting strict overcommit policies, PostgreSQL aims to prevent unexpected process termination caused by the Linux OOM killer, which can lead to data loss and service outages. This change underscores a broader industry trend toward prioritizing predictable, stable memory management in critical database systems, especially as data volumes grow and hardware becomes more complex.
Linux server memory overcommit settings
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Background on Memory Management and PostgreSQL Stability
Linux’s default memory overcommit policy has historically allowed processes to allocate more memory than physically available, relying on the kernel to handle overcommit scenarios. While this can improve performance in some cases, it also increases the risk of the OOM killer terminating processes when memory is exhausted. For database systems like PostgreSQL, such terminations can cause data corruption, transaction failures, and downtime.
In recent years, the industry has seen increased scrutiny of overcommit policies, especially as deployments scale up and stability becomes critical. PostgreSQL, which is widely used in enterprise environments, has faced challenges related to unpredictable OOM killer behavior, prompting discussions about more conservative memory management strategies.
In response, PostgreSQL’s core developers examined various Linux kernel configurations and ultimately decided to recommend strict overcommit settings, aligning with practices used in other high-availability systems to enhance reliability.
“Adopting strict overcommit settings is a key step toward ensuring PostgreSQL’s stability in large, memory-intensive deployments.”
— PostgreSQL Development Team

Tricks for Python performance optimization and memory management – Tips for efficient resource usage and speedup using profiling tools – (Japanese Edition)
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Uncertainties Around Deployment and Performance Impacts
It is not yet clear how widespread adoption of strict overcommit settings will be across different Linux distributions or how it will impact overall system performance in diverse workloads. Some users report potential performance trade-offs, but comprehensive data is still emerging.
Additionally, the long-term effects on other applications running alongside PostgreSQL under these configurations remain to be studied.

High-Performance Memory Management: A Practical Guide to Kernel Optimization: Learn NUMA Architecture, Reduce Page Faults, Eliminate Memory Fragmentation, and Improve Linux System Performance
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Next Steps for PostgreSQL and Linux Memory Management
PostgreSQL plans to release updated documentation and best practices for configuring Linux systems with strict overcommit policies. Community discussions are expected to focus on balancing stability with performance, especially in large-scale deployments.
Monitoring tools and benchmarks are likely to be developed to assess the real-world impact of these changes, guiding further refinements in configuration recommendations.
Memory overcommit configuration for Linux
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Key Questions
Why did PostgreSQL change its memory overcommit recommendations?
To reduce the risk of the Linux OOM killer terminating PostgreSQL processes during high memory usage, which can cause crashes and data corruption.
What Linux setting is now recommended for PostgreSQL deployments?
Setting vm.overcommit_memory=2 to enforce strict memory overcommit policies, along with tuning vm.overcommit_ratio.
Will this change affect performance?
Potentially, as strict overcommit policies may limit memory allocation flexibility. Performance impacts depend on workload and hardware configuration, and ongoing testing is expected.
Is this change applicable to all Linux distributions?
While the recommendation is based on kernel parameters common across distributions, specific implementation details may vary, and users should verify compatibility.
What should system administrators do now?
Review and adjust kernel memory settings to align with PostgreSQL’s new recommendations, and monitor system stability and performance closely.
Source: hn