How to achieve zero-downtime scale up and down PostgreSQL flexible server

Ruppel, Julian 70 Reputation points
2023-12-21T21:25:27.33+00:00

When scaling compute, https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-business-continuity#planned-downtime-events states

During compute scaling operation, active checkpoints are allowed to complete, client connections are drained, any uncommitted transactions are canceled, storage is detached, and then it's shut down. A new flexible server with the same database server name is provisioned with the scaled compute configuration. The storage is then attached to the new server and the database is started which performs recovery if necessary before accepting client connections. ... When the flexible server is configured with high availability, the flexible server performs the scaling and the maintenance operations on the standby server first. For more information, see Concepts - High availability.

and https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-high-availability

For other user initiated operations such as scale-compute or scale-storage, the changes are applied at the standby first, followed by the primary. Currently, the service is not failed over to the standby and hence while the scale operation is carried out on the primary server, applications will encounter a short downtime.

Is there a way to avoid the downtime?

For managed maintenance it seems to be possible using HA fail-over

For flexible servers configured with high availability, these maintenance activities are performed on the standby replica first and the service is failed over to the standby to which applications can reconnect.

Read replicas would be a natural fit, but the docs https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-read-replicas give no hints about a (automated) process where the scaling is conducted without downtime using the replicas.

Azure Database for PostgreSQL
0 comments No comments
{count} vote

Accepted answer
  1. GeethaThatipatri-MSFT 29,552 Reputation points Microsoft Employee Moderator
    2023-12-22T02:26:25.9766667+00:00

    @Ruppel, Julian Welcome to Microsoft Q&A thanks for posting your question.

    In Azure postgres flexible server, you can scale compute and storage (together or independently).

     

    1. Compute – when you scale compute tier, the server is restarted for the new server type to take effect. Learn more
    2. Storage – Storage in most cases can be scaled online without any server restart. There are a few exceptions to this when storage scale does require restart. Learn more

    Also recently, we have also introduced new feature called ‘Near Zero Downtime’ that can reduce the restart start to less than 30 sec and improves the overall availability of your flexible server workloads.

    Regards

    Geetha

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.