databases-storage

PostgreSQL 18 introduces libnuma support for better NUMA performance

Key Takeaway

PostgreSQL 18 includes patches to micromanage NUMA policies, interleaving shared resources while localizing backend memory to improve performance on large multi-processor systems.

Summary

PostgreSQL 18 will feature a significant update to how the database handles Non-Uniform Memory Access (NUMA) architectures via libnuma. The changes, contributed by Tomas Vondra, allow the system to interleave shared resources like shared buffers and the ProcArray while ensuring backend-local allocations remain on the local NUMA node. This approach aims to reduce memory access penalties and lock contention on large-scale hardware.

Technical improvements in PostgreSQL 18 NUMA handling

  • Shared Resource Interleaving: Shared buffers and freelists are explicitly interleaved across all available nodes to maximize throughput.
  • ProcArray Transformation: The ProcArray has been converted from an array to a linked list (renamed to PGProc) to allow it to be spread across different NUMA nodes.
  • Backend Memory Localization: Local allocations for backends are now set to a local allocation policy, preventing the performance penalty of distributed local memory.
  • New System View: A new view, pg_shmem_allocations_numa, has been added to monitor where memory is stored.
  • Huge Pages Requirement: The use of huge pages becomes even more critical to prevent buffer pages from being split across different memory controllers.

Why it matters

These changes significantly optimize PostgreSQL for high-end enterprise servers and large-scale database deployments running on multi-socket Linux systems.

Original reference: postgr.es →