Postgres is now async by Default

· Source: Hussein Nasser · Field: Technology & Digital — Software Development & Engineering, Cloud Computing & IT Infrastructure · Depth: Advanced, quick

Summary

PostgreSQL has updated its default I/O method to the worker method, making it asynchronous by default across all supported platforms, including Mac, Windows, and Linux. This change is reflected in the "IO method" global user configuration (GUC), which now defaults to "worker". While the worker method is universally available, users on Linux systems with kernel version 5.x or higher can optionally switch to IO_uring for asynchronous I/O. IO_uring operates using submission and ready queues with shared memory between user and kernel space. The text notes that shared memory between user and kernel space has historically presented security challenges, as direct access from user space to kernel space typically requires a mode switch. The shift to the worker method as default may have been implemented to address potential bugs.

Key takeaway

For DevOps Engineers or Database Administrators managing PostgreSQL deployments, understanding the new async-by-default worker method is crucial. Your systems will now leverage asynchronous I/O out-of-the-box, potentially improving performance and stability. If running on Linux kernel 5.x+, you can evaluate switching to IO_uring for potentially higher performance, but be mindful of its historical shared memory security considerations. This change simplifies async setup and requires reviewing existing I/O configurations.

Key insights

PostgreSQL now defaults to an asynchronous worker-based I/O method, enhancing performance and consistency across platforms.

Principles

Method

The IO_uring mechanism involves submitting jobs to a submission queue and retrieving results from a ready queue, utilizing shared memory for communication between user and kernel spaces.

In practice

Topics

Best for: CTO, VP of Engineering/Data, Data Engineer, Software Engineer, DevOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Hussein Nasser.