TL;DR

PostgreSQL has implemented stricter memory overcommit policies to mitigate the risk of Linux’s Out-Of-Memory killer terminating critical database processes. This change aims to improve stability and predictability in high-load environments.

PostgreSQL has officially adopted a policy of strict memory overcommit to reduce the risk of being terminated by the Linux Out-Of-Memory (OOM) killer. This change, confirmed by PostgreSQL developers, aims to improve database stability in environments with high memory usage, where the OOM killer can otherwise cause unexpected outages.

In recent updates, PostgreSQL has adjusted its memory management settings to favor strict overcommit policies on Linux systems. This approach limits the kernel’s ability to over-allocate memory beyond physical RAM, thereby decreasing the likelihood that the OOM killer will target PostgreSQL processes during memory shortages.

According to PostgreSQL core developers, the move was driven by observed failures where the OOM killer terminated database processes unexpectedly, leading to data inconsistency and service interruptions. By configuring the system to disallow overcommit, PostgreSQL aims to create a more predictable environment, especially in high-load or resource-constrained deployments.

Linux’s memory overcommit settings are controlled via the kernel parameter vm.overcommit_memory. Setting this to ‘strict’ (value 2) enforces the system to refuse memory allocations that exceed available RAM, which helps prevent the OOM killer from intervening under normal circumstances.

At a glance
reportWhen: announced April 2024
The developmentPostgreSQL developers have shifted to strict memory overcommit settings, citing the need to prevent the Linux OOM killer from terminating database processes during memory pressure.

Impact of Strict Memory Overcommit on PostgreSQL Stability

This change is significant because it directly addresses a common cause of database outages—unexpected termination by the Linux OOM killer. By adopting strict overcommit policies, PostgreSQL aims to enhance the reliability of critical systems, especially in cloud and containerized environments where resource contention is frequent. This adjustment may also influence how system administrators configure Linux hosts for database workloads, emphasizing the importance of predictable memory management.

Amazon

Linux server memory overcommit settings

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background on Linux Memory Management and PostgreSQL

Linux systems use the vm.overcommit_memory kernel parameter to control how memory overcommitment is handled. The default setting often allows overcommit, which can lead to situations where the OOM killer terminates processes to free memory. PostgreSQL, as a memory-intensive database, is particularly vulnerable to such terminations, which can cause data corruption or service outages.

Historically, PostgreSQL has relied on the operating system’s default memory management policies, but recent incidents of unexpected process termination prompted a reassessment. The move to strict overcommit aligns PostgreSQL with best practices aimed at reducing unpredictable behavior during high load or memory pressure.

Similar strategies have been adopted by other high-availability systems, but PostgreSQL’s change marks a significant shift in how database systems are configured for stability on Linux platforms.

“Implementing strict memory overcommit settings is a crucial step toward ensuring our database processes are not arbitrarily killed during memory shortages.”

— PostgreSQL core developer

Amazon

PostgreSQL high memory server

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Remaining Questions About Overcommit Policy Effects

It is not yet clear how widespread the impact of this change will be across different deployment environments. Some administrators worry that strict overcommit may lead to memory allocation failures under high load, potentially causing application errors or requiring more precise capacity planning. The long-term effects on performance and scalability are still being evaluated.

Amazon

Linux kernel vm.overcommit_memory configuration

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Next Steps for PostgreSQL and Linux Memory Configuration

PostgreSQL plans to monitor the impact of this policy in real-world deployments and gather feedback from users. System administrators are encouraged to review their memory settings and capacity planning strategies accordingly. Future updates may include best practices documentation and further refinements to memory management configurations.

Concepts of Database Management (MindTap Course List)

Concepts of Database Management (MindTap Course List)

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

Why is PostgreSQL changing its memory management approach?

To reduce the risk of being terminated by the Linux OOM killer during memory shortages, which can cause outages and data loss.

What is Linux’s vm.overcommit_memory setting?

It controls how the kernel handles memory overcommitment. Setting it to ‘2’ enforces strict limits, preventing over-allocation beyond available RAM.

Could strict overcommit settings cause other issues?

Yes, it may lead to memory allocation failures if capacity planning is not adequate, requiring careful resource management.

Will this change affect all Linux systems running PostgreSQL?

It depends on the deployment; administrators need to configure vm.overcommit_memory appropriately based on their workload and environment.

Is this a temporary or permanent policy shift?

This is a confirmed, ongoing policy aimed at improving stability, with future adjustments based on operational feedback.

Source: hn

You May Also Like

Dual‑Head Chargers: The Charging Speed Myth You Need to Know

No, dual-head chargers don’t double your speed—discover the surprising truth behind how they actually work and why understanding this can save you time.