Cloud Foundry zero downtime deployments
Software releases can be a very painful experience and typically involve some downtime, especially to traditional monolithic applications. As we have seen in previous posts the process of pushing code to a platform like Cloud Foundry is quite easy but it still a push can take between one and two minutes and during the most part the app has to be down. One or two minutes doesn't sound too bad for most people, but while working for EMC I have met some customers for which "mission critical" has a complete different meaning. I have seen systems where 1 second downtime could be measured in hundreds of millions of dollars.
There is lots of talk about CI/CD (Continuous Integration and Continuous Delivery) but here we are talking about accepting a minute downtime. Well, the good news is that Cloud Foundry has the tools to allow you to do a zero downtime deployment. The most common procedure is typically referred to as "Blue-Green deployment.
The trick is to have two environments (Blue and Green) and to bring them up concurrently and balance connections between them. The old and new code coexist for a short while until the deployment team has determined everything is OK.
The trick is to have two environments (Blue and Green) and to bring them up concurrently and balance connections between them. The old and new code coexist for a short while until the deployment team has determined everything is OK.
Or they could potentially be up concurrently for a longer time to perform A/B tests. Typically you want small amount of connections hitting the new code or your A/B test environment. This is controlled from the load balancer. Cloud Foundry out of the box is able to do round-robin between all instances of the same app. So in the absence of more sophisticated load-balancers if you wanted 10% of your connections to use the new code you could spin up 1 instance with the new code for every 9 instances currently in production.
All this is made possible by distinguishing between the app name and the route to access it. For example when you do
cf push myappname
as we did in post Cloud Native Apps with Cloud Foundry Cloud Foundry will create route:
http://myappname.cfapps.io
If you have more than one domain you get a chance to specify that too. This is fine and good but you can also specify both the app name and the route it will be accessed on (and optionally the domain) like this
cf push myappname -n my-app-staging
And then it will be accessible at
http://my-app-staging.cfapps.io
Then you can make use of the "cf map-route" and "cf unmap-route" to assign different routes to the apps, such as production or staging. Take a look at the video for more details.
Comments
Post a Comment