Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 13, 2022 11:46 am GMT

Blue/Green Deployments for RDS: How Fast is a Switchover?

AWS recently announced the general availability of RDS Blue/Green Deployments, a new feature for RDS and Aurora to perform blue/green database updates. One of the aspects that caught my eye is how fast a switchover is.

In as fast as a minute, you can promote the staging environment to be the new production environment with no data loss.

Lets give it a try! How can we check how long a switchover really takes? We will perform the simplest test, using only a MySQL client and a while loop in Bash:

while true; do mysql -s -N -h renato-cluster.***.eu-west-1.rds.amazonaws.com -u renato -e "select now()"; sleep 1; done(...)2022-12-09 07:58:552022-12-09 07:58:562022-12-09 07:58:572022-12-09 07:58:58(...)

We keep asking every second for the current date and time to the RDS server and we will check what happens when we trigger a switchover. We will compare the results with a reboot and a reboot with failover. To perform the test we will use an m6g.large Multi-AZ instance with some production traffic, a cluster where the Seconds_Behind_Master value of a replica hardly goes above a single-digit number.

Rebooting an instance

Using the CLI, we can perform a reboot of an RDS instance without forcing a failover of the database server.

aws rds reboot-db-instance --db-instance-identifier renato-cluster --no-force-failover(...)2022-12-09 08:00:012022-12-09 08:00:022022-12-09 08:00:032022-12-09 08:00:232022-12-09 08:00:242022-12-09 08:00:25(...)

That is just about 20 seconds for a reboot of an RDS instance.

Rebooting with failover

We can now repeat the test forcing a failover:

aws rds reboot-db-instance --db-instance-identifier renato-cluster --force-failover(...)2022-12-09 08:01:112022-12-09 08:01:122022-12-09 08:01:132022-12-09 08:03:282022-12-09 08:03:292022-12-09 08:03:30(...)

This time it takes longer, including the time required to switch the CNAME of our database to the new IP address: 2 minutes and 15 seconds.

Switching a blue/green deployment

Finally, we can trigger a switchover in our blue/green deployment calling:

aws rds switchover-blue-green-deployment --blue-green-deployment-identifier renato-cluster-bg(...)2022-12-09 08:06:592022-12-09 08:07:002022-12-09 08:07:012022-12-09 08:08:072022-12-09 08:08:082022-12-09 08:08:09(...)

The switchover time of the RDS Blue/Green Deployments is just about a minute: 1 minute and 6 seconds.

Recap

  • Reboot: 20 seconds
  • Reboot with failover: 135 seconds
  • Switchover: 66 seconds

The switchover of an RDS for MySQL instance is as fast as a minute and significantly faster than a reboot with failover of a Multi-AZ instance. Of course, the switchover can take significantly longer according to the write load of your production database. This was only a basic test to validate the minimum downtime for a switchover.

Questions? Comments? Contact or follow me.
Originally published on cloudiamo.com.


Original Link: https://dev.to/aws-heroes/bluegreen-deployments-for-rds-how-fast-is-a-switchover-48bf

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To