Blue Green Deployment | How To Achieve Zero Downtime | TTT | Cuelogic

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everybody and welcome back to ttt in this ttt episode we're going to talk about a useful devops technique of releasing bug-free software while minimizing application downtime and providing a quick way to roll back updates first we'll explain what this technique is through an example and then go through the details of how you can implement this technique we'll also examine an important consideration of this approach keeping your data in sync let's dive in so what is this technique that helps you ensure maximum application uptime gives you a disaster recovery mechanism and ensures that you're not called into work at crazy hours to roll back an upgrade to find out let's visit our friend sarah the devops engineer sarah is working on building a website that sells movie tickets the back end of this website is supported by microservices which handle user identification movie updates new trailer releases and more sarah wants to release an update which adds a countdown and exclusive booking for midnight premieres but sarah doesn't really want to wait until 2 am when the least amount of users are active and then deploy the updated code she also doesn't want users to experience downtime and lags during financial transactions but how can she ensure uninterrupted uptime and stable transactions while simultaneously getting a good night's sleep the answer is blue green deployment so what is blue green deployment blue green deployment is a devops release management technique that reduces downtime and code deployment risks this technique uses two identical production environments blue and green to run tests and provide reliable zero downtime software upgrades the goal of blue-green deployment is to achieve immutable infrastructure where you don't make changes to your application after it's deployed but redeploy altogether now let's take a look at how blue-green deployment works blue-green deployments start with two separate but identical environments here environment is a very broad term which includes servers virtual machines containers operating systems and anything else you need to run your code sometimes the environments can be physically two separate machines other times they can be two virtual machines running on the same hardware or even different containers running on a single device the old or live environment is called blue and the new or test environment is called green it's important to remember that both blue and green are running in production after testing is completed in the green environment production traffic is gradually transferred from blue to green after this is done blue can stand by in case of rollbacks or as a disaster recovery mechanism after the deployment blue becomes a test environment for new code deployments and green becomes a live environment now let's look at this in more detail consider that blue is the active production environment and green is a staging environment right now blue is active this means that blue receives all production traffic and we can run an exhaustive test suite in green it's important to remember that we need a mechanism of switching traffic between blue and green this mechanism can be a router load balancer reverse proxy or web server after we are satisfied that everything is running smoothly in green we can gradually transfer production traffic from blue to green when all the traffic has been transferred to green we can be sure that our deployment is complete the cloud can make blue-green deployments simpler and more accessible for everybody the cloud allows us to abstract away the infrastructure and spin up instances whenever we require because of the scalability and cost effectiveness of cloud computing blue-green deployments become more cost-effective since we don't have to maintain two separate copies of everything even on the cloud the concept remains the same first the blue environment is live when we have to deploy a new release we can use cicd tools to create an identical new environment we're satisfied that everything works properly in green we can reroute production traffic to green because the cloud allows us to spin up and scrap environments as needed in a cost effective way we can either scrap the blue environment or keep it as a backup or disaster recovery mechanism in case we need to roll back we can do so instantly by simply switching or rerouting production traffic to the blue environment this is what sarah our devops engineer decided to do she set up a blue green deployment model to add a countdown and exclusive booking for midnight premieres to her movie tracking website she and her team first tested the new functionality in green and when they were happy that everything worked the way it was supposed to they rerouted production traffic to green that way there was minimal downtime for users by running to the environment simultaneously so that the website was always available sarah could complete the deployment at any time of day so what are the advantages of blue-green deployment the single biggest advantage of this code release technique is that it allows you to run tests in an environment that truly mirrors the production environment because of this any errors that you miss in a different non-identical test environment don't reach production next because one environment is always available you don't have to wait for the minimum traffic window to deploy your application this means that you can deploy at any time of day that's convenient for you also because of instant cut over users are switched to the new environment almost instantly there's hardly any lag and everyone sees the new release at the same time instant cutover works both ways if you need to roll back the new release for whatever reason we can reroute production traffic instantly an implication of this is that in case the live production environment goes down due to for example a malfunctioning data center we can instantly reroute production traffic to our blue environment which acts as a standby finally debugging becomes easier with blue-green deployment if rollback is necessary we reroute traffic to blue after rollback to blue the green and presumably failed deployment is still intact for analysis one important thing to consider is what you plan to do with interrupted user transactions during the cutover some user transactions will be affected if the cutover happens at the exact moment a transaction such as buying a midnight movie premier ticket in zera's case takes place in such a case we could present an error message and ask the user to try again or we could feed all transactions to both blue and green environments in parallel in this case we would need to delete any duplicate data after we finish our deployment this brings us to a critical consideration in the blue green deployment model keeping data in sync in the blue and green environment so how should we handle data during blue-green deployment the easiest way to ensure that data is in sync between the blue and green environment is to have both environments share a data store this is easily done with unstructured data stores such as amazon's s3 object storage in the case of a structured data store such as a relational database management system the database schema can diverge between environments in such cases it's best to decouple the schema changes from the code changes there are two ways of doing this first you can change the schema before the blue green deployment in this case database updates need to be backward compatible so that the old application version can still interact with the data in this approach developers usually use additive schema modifications this means that you can add fields entries and more the other way of keeping data in sync is to change the schema after the blue green deployment in this case code changes need to be made backward compatible with the old schema so that the application can interact with the non-updated schema in this approach developers make schema modifications that are deleted which means that unneeded fields and entries can be deleted consolidated or merged you can do this because by this time the deployment has finished and the old application is no longer operational but be careful sometimes depending on other technical considerations schema changes may be too complex to decouple from code changes and it also may not be possible to share a data store if the blue and green environments are in separate geographical locations it may introduce another layer of complexity to deal with these considerations you may have to build a solution in which data changes are tightly synced and propagated from green to blue and vice versa the processes that underlie this are complex and need to be dealt with carefully since they can add risk to the deployment so we've seen what blue green deployments are and why they are a deployment strategy that you should consider we've also talked about how to implement a blue-green deployment and ensure that your data stores stay in sync and finally we've seen some important considerations that you need to keep in mind while using this technique we help organizations from startups to established companies to accelerate their software deployment process in a secure and risk-free way our engineers help you continuously deploy bug-free software while ensuring minimal downtime if you want to implement blue-green deployment but need some technical guidance while doing so reach out to us at info keylogic.com our experts will give you guidance on how to implement a devops enabled deployment strategy so that brings us to the end of this video thanks for watching and if you found our explanation helpful please comment like and share this video don't forget to subscribe to our youtube channel to be immediately notified of additional tech updates thanks a lot and i'll see you in the next ttt episode
Info
Channel: Cuelogic Technologies | An LTIMindtree Company
Views: 12,134
Rating: undefined out of 5
Keywords: Blue green deployment, blue green deployment example, blue green deployment tutorial, devops, devops technique, red black deployment, blue green microservices, what is blue green deployment, deployment, continuous deployment, downtime, women in tech, technology, what is blue green deployment in microservices, girlswhocode, womeninstem
Id: Y711-2RoT5s
Channel Id: undefined
Length: 11min 18sec (678 seconds)
Published: Mon Mar 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.