Jump to Content
Databases

Cloud SQL for PostgreSQL now supports Linux Huge Pages

August 31, 2021
https://storage.googleapis.com/gweb-cloudblog-publish/images/BlogHeader_Databases_3.max-2600x2600.jpg
Robert Pang

Software Engineer

Bala Narasimhan

Group Product Manager, Google Cloud

Try Google Cloud

Start building on Google Cloud with $300 in free credits and 20+ always free products.

Free trial

We are excited to announce that Cloud SQL for PostgreSQL now supports Linux 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 huge_pages flag.

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.
https://storage.googleapis.com/gweb-cloudblog-publish/images/sql_overview.max-1400x1400.jpg

Learn more about Cloud SQL for PostgreSQL here.

Posted in