Blue-green deployment, canary release (gray release), AB test

With the popularization of microservice architecture, there are more and more online services, which are followed by more and more frequent deployments; with the prosperity of the Internet industry, the frequency of product iterations is getting faster and faster, and the speed of service launches is gradually increasing. . There is a risk if it is online and deployed. If there is a risk, it will have an impact on the business. Then there are a series of deployment plans to reduce this risk: blue-green deployment, canary release (gray release), and AB testing that adapts to the frequency of product iterations.

This article is mainly to briefly explain these concepts to help yourself understand. If there is an error, please correct me.

Blue-green deployment

Blue-green deployment is a technology that reduces downtime and reduces risk by running two identical production environments called BLUE and GREEN.

Blue-green deployments are named after colors. The simple understanding is that there are two cluster environments on the line. In the architecture diagram, one set is marked as blue, called blue cluster BLUE; one set is marked as green, called green cluster GREEN. By introducing traffic into the two clusters, the system upgrade and switch are completed.

blue green deployments

Step 1: Deploy the green cluster. This is the initial state. The blue cluster assumes full responsibility, receives all traffic, and waits for it to be replaced. The green cluster has just been deployed and has not yet been put into use. The traffic is 0, waiting for verification and going online.

Step 2: The traffic of the blue cluster remains unchanged, and the traffic is introduced to the green cluster. This process can be divided into several stages to complete. In the first stage, a small amount of non-real-time traffic is introduced, which is only used for data testing; in the second stage, all real-time traffic is introduced for system verification.

Step 3: Cut off the traffic introduced to the blue cluster, and introduce all traffic to the green cluster. At this time, the green cluster has assumed full responsibility and received all traffic. This process can also be operated in stages. In the first stage, the blue and green cluster traffic is balanced, that is, the blue and green clusters assume responsibilities together; in the second stage, the blue cluster traffic is cut off and all the traffic is written to the green cluster. Whether to adopt a phased operation depends entirely on whether the upgraded function is destructive and compatible.

Step 4: Monitoring system operation, this process is necessary. Because no one can guarantee 100% coverage during the test, the new cluster may have problems such as that, large or small, and if the evaluation needs to be rolled back, all traffic needs to be switched to the blue cluster. Version rollback has also been completed.

Canary release (grayscale release)

Canary release is different from blue-green deployment in that it is not a black-and-white deployment method, so it is also called gray-scale release. It can slowly promote the modification to a small number of users, and after verifying that there is no problem, it can be promoted to all users to reduce the risk of introducing new features into the production environment.

canary releases

Step 1: Move traffic out of the node to be deployed, update the service of the node to the state to be released, and call the node a canary node;

Step 2: Introduce traffic to the canary node according to different strategies. Strategies can be specified according to the situation, such as random sample strategy (introduced randomly), dog food strategy (that is, internal users or employees early adopters), partition strategy (users in different regions use different versions), user characteristics strategy (this is more complicated and needs to be based on The user’s personal data and characteristics are split, similar to a thousand people and a thousand faces);

Step 3: After the canary node is verified, select more nodes called canary nodes, repeat steps 1 and 2 until all nodes are updated

AB test

The AB test and the above two publishing methods are not a range of concepts. They are used to verify the effects. The other two are used to achieve smooth online publishing. They are put together here because of these three concepts. It's easy to get confused.

AB testing is to run multiple different versions of services online at the same time, these services are more user-side experience, such as page layout, button colors, interaction methods, etc., usually the underlying business logic is still the same, which is usually said Change the soup without changing the dressing.

A/B Testing

There is no specific step for this (you can also use the canary deployment steps, but not the full update), according to the strategy (this strategy can be the same as the strategy in the canary distribution), introduce part of the traffic into version A, and the other part of the traffic With the introduction of version B, CDEF version may also appear. Then the relevant personnel select the best solution by analyzing the actual effects of different versions. The optimal solution may be that one version wins and replaces another version, or it may spawn more versions to serve users, or it may be that multiple versions provide services in different regions at the same time.

At last

Here is a summary:

name Features Advantage Disadvantage
Blue-green deployment There are two clusters at the same time, only one of the two clusters really provides services, and the other cluster is tested, verified or on standby Service documentation, simple version rollback, suitable for upgrades in various scenarios, large version incompatible upgrades or iterative compatible upgrades A waste of hardware resources requires two clusters at the same time. If the cluster is relatively large, such as 1000 nodes, this method is almost unavailable
Canary deployment Deploy point by point and gradually replace online services Run in small steps and iterate quickly It can only be applied to the compatible iteration method. If it is a scene where the major version is not compatible, there is no way to use this method.

The AB test and the above two are not in the same category, so there is no comparison. But it needs to be explained that the AB test can use the above two deployment methods.

参考:
Using Blue-Green Deployment to Reduce Downtime and Risk
Blue Green Deployment
Blue-green Deployments, A/B Testing, and Canary Releases
Canary Release


Personal homepage: http://www.howardliu.cn
Personal blog post: blue-green deployment, canary release (grayscale release), AB test
CSDN homepage: http://blog.csdn.net/liuxinghao
CSDN blog post: blue-green Deployment, canary release (gray release), AB test

Guess you like

Origin blog.csdn.net/conansix/article/details/102758824