Perform Amazon Aurora PostgreSQL minor version upgrades with minimal downtime via minor version update improvements

by Peter Celentano | on

When using Amazon Aurora PostgreSQL-Compatible Edition , managing updates is an ongoing management process for database administrators. Minor version updates are a component of this process—they contain database patches, and bug fixes are a much more common management task to orchestrate. Amazon Web Services provides mechanisms that assist in applying updates, but you are able to decide when they are applied. These updates occur during specified maintenance windows (or can be manually applied), and in many cases require an instance reboot.

In this post, we discuss a series of improvements to the minor version update process that allow for reduced downtime and fewer disruptions to your workloads.

Use case

According to the PostgreSQL Global Development Group , “New major versions containing new features will be released about once a year. Each major version receives bug fixes and, if needed, security fixes that are released at least once every 2 months in what we call a ‘minor release.’”

When critical security patches are needed for a PostgreSQL version, those updates are made available as soon as possible after released by the PostgreSQL Global Development Group, often within hours of release. Additionally, when minor version updates are released, there is currently no means to identify if a minor version update will result in instance reboot (though a reboot is not always needed). When applying minor version updates, it’s safe to assume that the update will require a reboot in order to fully apply it to the cluster.

Before the improvements to the Amazon Aurora PostgreSQL minor version update process, reboots resulting from minor version updates caused connections to the rebooting compute instance to be lost, which is the current default behavior for open-source PostgreSQL. The updated behavior (applying to older Amazon Aurora PostgreSQL-Compatible Edition version releases) results in a database restart consistent with the open-source PostgreSQL experience, requiring more time for the database compute instances to be brought back online.

Minor version update improvements

The minor version update improvements for Amazon Aurora PostgreSQL-Compatible Edition provide a number of improvements to the update process. The primary benefits these improvements provide include preservation database and file system metadata, which allows for a faster database restart as part of the update process. Previously existing database sessions can now be restored to your cluster’s read/write instance, minimizing much of the downtime related to applying minor version updates. Additionally, existing connections to the cluster read/write instance are preserved. In testing the upgrade process from Aurora PostgreSQL v 11.17 -> v11.18 (pre-improvement) to 11.18 -> 11.19 (with improvements), the following observations were made:

Aurora Minor version update improvements benchmarked
Aurora PG Version Loss of writer connectivity Writer connectivity returns Writer instance unavailability
11.9 -> 11.13 18:53:52.062996 18:54:10.314688 16.15 seconds
11.17 -> 11.19 19:45:10 19:45:10 Less then 1 second

Testing with the above versions, a total reduction in writer instance downtime of 15.15 seconds was observed.

Limitations

Although the zero-downtime patching for Amazon Aurora PostgreSQL-Compatible Edition reduces the overall amount of downtime involved in applying minor version updates, this update process still requires a small period of downtime. The length of the downtime may vary depending the individual cluster or instance size. Additionally, this enhancement only applies to Amazon Aurora PostgreSQL-Compatible Edition read/write endpoints and not to all compute instances in the cluster.

Conclusion

Enhancements to Amazon Aurora PostgreSQL-Compatible Edition minor version updates through zero downtime patching result in a lower overall impact to your workloads while still allowing you to easily apply minor version updates (now with less downtime). These enhancements are available in all minor version updates of Amazon Aurora PostgreSQL-Compatible Edition as of January 23rd, 2023 , and no further action is needed by customers in order to use it.

If you have questions, comments, or suggestions on the content covered in this post, leave them in the comments section.


About the Author

Peter Celentano is a Senior Specialist Solutions Architect with Amazon Web Services, focusing on managed PostgreSQL. He works with Amazon Web Services customers to design scalable, secure, performant, and robust database architectures on the cloud.