Understand CD (Continuous Deployment) in 5 Minutes

Florian Bouron
AWS in Plain English
3 min readJun 21, 2021

--

We will see which deployment strategy you should use for the next deployment of your application.

Architect representing the deployment strategies
Architect representing the deployment strategies

What is Continuous Deployment?

The continuous deployment consists of automatically delivering (deploying) your code to your end-users. It is the last step of your delivery pipeline.

Let’s see different strategies that you can apply during your deployments.

Blue/Green deployment

Blue/Green deployment contains two hosting environments: the blue one and the green one. One of these environments is for production and the second one is the non-production environment (development or testing).

When a new release is deployed, it goes to the non-production environment to get validated. When the environment is validated, we need to switch the non-production to production. This means that all the traffic is redirected from the production to this non-production environment. The previous production environment becomes then the non-production environment.

To summarize, it means that we are inverting the role of each environment between production and non-production.

Here are a few advantages of blue/green deployment:

  • It avoids versioning issues as the entire application state changes in one go.
  • Instant rollout/rollback.

Here are a few disadvantages of blue/green deployment:

  • The entire application needs to be tested before releasing to production.
  • Applications are usually stateful, which can be hard to manage.
  • Expensive as it requires double resources (two environments).

Canary deployment

Sometimes swapping the entire traffic to the new environment might not be desirable or workable.

With the canary deployment, a portion of the incoming traffic is routed to the test environment. If the test environment is successful, then gradually, the traffic is 100% switched to the new version. This will then make the previous version retire.

Canary deployment is mostly used when there is low confidence about the new release stability.

Here are a few advantages of canary deployment:

  • Fast rollback.
  • Released for a subset of users.
  • Convenient for error rate and performance monitoring.

Here are a few disadvantages of canary deployment:

  • Slow rollout.

A/B testing deployment

In contrary to canary deployment, A/B testing will keep two versions running at the same time. It consists of routing a subset of users to another version depending on certain conditions. That kind of deployment is widely used to help with business decisions and test which versions (A or B) perform the best for a certain goal.

For example, you could have two versions running at the same time depending on the following points:

  • Language
  • Geolocalisation
  • Browser cookie
  • Query parameters
  • Browser version, screen size, operating system, ….

Here are a few advantages of A/B testing deployment:

  • Several versions can run in parallel.
  • Full control over the traffic distribution.

Here are a few disadvantages of A/B testing deployment:

  • Hard to troubleshoot errors for a given session, distributed tracing becomes mandatory.
  • Requires an intelligent load balancer.

There are other deployment strategies, some of which will be explained in this section. I would personally suggest to you to avoid them as much as you can.

Recreate deployment

Recreate deployment consists of shutting down version A then deploying version B after version A is turned off.

Here are a few advantages of the recreate deployment:

  • Easy to set up.

Here are a few disadvantages of the recreate deployment:

  • High impact on the user, big downtime to be expected.

Summary

Depending on what you want to achieve, you can use one of the above deployment strategies. There are more strategies like ramped deployment or shadow deployment.

I hope you enjoyed the read and if you want to see my next articles, feel free to follow me on Medium.

More content at plainenglish.io

--

--