The meaning of the word “deploy” is “to spread out or arrange strategically,” which comes from the “deployer” in French, mostly being used as a military term.
In software, what you mean by deployment makes the best of the word as it is in the military.
How to find the best strategy to spread your application over instances without downtime in a flexible and scalable way?
There are many deployment strategies for deploying an application to the production environment. Choosing the right strategy is a matter of application performance, user experience, and deployment speed. We live in an era of instant delivery. The features that have been implemented need to be reflected rapidly and constantly. Having the best deployment strategy is very important to mitigate the risk in your highly available resilient services.
Software deployments might differentiate across companies, teams, and applications. The aim to find the correct strategy is about having flexible and scalable applications with zero downtime.
Blue-green deployment is a strategy that runs two identical production environments.
At any time, only one of the environments is live and serves all the production traffic.
How you implement this strategy is totally up to you! For example, you can have completely identical environments and initiate new instances in the current environment as a green state. Once the green environment is up and running with the latest changes in a stable state, the load balancer will route the production traffic there. The blue environment can be destroyed or used as a staging environment for future deployments.
- The Blue environment is the current environment that handles all the production traffic.
- The Green environment is the idle one with the latest changes and is ready to be switched on.
➕ Pros of Blue-Green Software Deployment Strategy
- Easy to implement
- Straightforward rollback
- Rapid releasing
➖ Cons of Blue-Green Software Deployment Strategy
- Expensive as you need to replicate a production environment
- Database management can be challenging as both environments are supposed to work at the same time (even if they are not getting any traffic)
- Hard to track experimental behavior of software
Blue-Green Deployment in 3 steps
Step 1: Current State
We have 3 instances on the production up and running! No deployment is initiated at this time.
Step 2: Deployment State
A new deployment is initiated to change or upgrade the application; during this state, we will create an identical environment (instance counts, types, etc) that has the latest changes.
Step 3: Route the traffic to the green environment
The green environment is up and stable, and we ensured the system is performing the way it’s expected to with health checks. Switch the traffic to the green environment.
The aim is to make the needed changes with zero downtime. As a result, end users will barely notice the improvements with Blue-Green Deployment.
Canary deployment is a strategy that incrementally deploys the new version of an application (e.g.: 5%, 25%, 80%, 100%) to a subset of users. This strategy helps you to reduce the risk of introducing a new feature in production. The limited users that are capable of seeing the new version will help to detect bugs in case of any broken features or other problems we are not aware of yet. You can monitor the new version for a period of time per your needs. If you identify an issue, you can pull the new version back easily; otherwise will be exposed to all users.
➕ Pros of Canary Software Deployment Strategy
- Cheaper than Blue-Green deployment as it does not require a new prod-identical environment
- With switching traffic incrementally, it has the lowest risk to release a new feature
- Control over feature releases
- Ability to run different versions of your application with real users
➖ Cons of Canary Software Deployment Strategy
- Complex to implement
- Breaking schema changes in the database may cause some problems. Having backward compatibility is a big plus.
Canary Deployment in 3 steps
Allocate 10% of the traffic to the new version
Allocate 45% of the traffic to the new version
We are happy with the results. No broken feature or bug was identified. It is time to allocate 100% of traffic to the new version 🥳
Which Software Deployment Strategy Should I Use?
You might still be asking, but which deployment strategy should I use?
The answer to this question is highly dependent on your application type, budget, and time. The above deployment strategies I shared use routing techniques to introduce new features and make improvements.
Please keep in mind that no deployment strategy is perfect, but based on your needs, you need to identify the best resilient strategy.
What now, then?
Exceptionly has many open remote software engineering job openings. Great pay, remote full-time work, continuous technical challenges, all-inclusive. Listen to what other software engineers say in our talent stories section.
Feel free to take a look at other posts I’ve shared under the tutorials category.