We are excited to announce that Cloud SQL for PostgreSQL now supportsLinux Huge Pages by default. If your instance has more than 2 GB of RAM then your PostgreSQL instance will use Linux Huge Pages for shared memory. This means the shared memory in your Cloud SQL for PostgreSQL instance will now use 2MB pages as opposed to the default 4KB pages. This has many benefits for your PostgreSQL workload. These include:
Improved memory usage by reducing each PostgreSQL process’ page table size which in turn means more memory is available for database operations.
Improved performance because more of the database’s working set can fit into the Translation Lookaside Buffers (TLB)
You can turn off Huge Pages by toggling the
For monitoring your PostgreSQL instance’s memory consumption, you can continue to use the
database/memory/total_usage metric. This is the most accurate metric to use since it also incorporates the Linux OS page cache footprint. You may see some changes in the behavior of the
database/memory/usage metric when Huge Pages are preallocated. This is expected and our recommendation is to use the
database/memory/total_usage metric for tracking your instance’s overall memory consumption. Here’s a screenshot on how you can get a hold of the Total Usage metric from the Cloud SQL UI.
Learn more about Cloud SQL for PostgreSQL here.