First, what is gray publishing?

To understand this problem, we need to understand what gray scale is. Gray scale literally means a smooth transition area between black and white, so for Internet products, online and offline is the difference between black and white, and a way to achieve smooth transition of offline functions is called gray scale release.

Black or white is never a common phenomenon, from the perspective of color, gray refers to unsaturated black, we take black as the reference color, each gray object from white (0%) to black (100%) median value, which is 98% gray.

Two, gray release mechanism?

You can select A part of users in many ways, for example, select your VIP users, or select some active users, divide these users into two groups, one group to release version A, the other group to release version B, and collect and record all possible data before release. In this way, the user data feedback of the two versions can be checked after the release, and the final release can be determined through a large amount of data analysis and investigation.

A complete grayscale publishing mechanism would include the following phases:

User identification: Mainly to distinguish users, but also to assist in data analysis.

Target user/traffic Filtering: Need to refer to the user characteristics, user traffic, user scale and the consistency of the user experience version iteration for all users or part of the user, through small flow test to moderate, in general, in accordance with the internal users – seed – active users – the order of all users is a kind of typical range control, experience the conformance requirements consider whether or not the old and the new version of the span is too large, Whether users can accept it.

Real-time data monitoring: monitoring the new version stability, server stability, use times, use frequency and other data compared with the original data.

One-click publish/roll back: Decide whether to publish/roll back from data feedback.

The picture below is the release engine of Ali software, which supports grayscale delivery.

Third, how to support gray scale when it comes to database changes?

Assume grayscale services, need to use the database, if the grayscale before and after the database fields remain unchanged, then the old and new two systems use the same set of database.

If the data before and after are inconsistent, the situation that needs to be dealt with is more complicated, which can be divided into the following situations.

  • Part of the gray

In the case of partial grayscale, part of the request to the old system, the other part of the request to the new grayscale system. Requests that go to the old system are processed as they are. However, the request to the new grayscale system needs to be forwarded to the corresponding interface of the old system to modify the data of the old system. If a request to the new system does not find the user’s data, you need to synchronize a copy to the new system first. If the request is transactional, the success of the operation is judged by the success of the write to the old system.

  • All gray

After the grayscale system has all taken over the online traffic, for the sake of safety, it is still necessary to double write the new and old systems, the steps are the same as before.

  • Gray finish

Grayscale completion is not quite the same as the previous full grayscale state, the difference is that in the previous full grayscale state, it is still not sure that the system must be no problem, so it is necessary to double write the old and new systems to ensure that the data can be rolled back on the old system. In the grayscale completed state, the new version is considered to have been fully verified and no longer needs to be written to the old system. However, there may be some users who are not online during the gray scale period. At this time, a synchronization is needed to synchronize this part of data from the old system.

It can be seen that in these three states, whether to double write the old system and the old system, made a strict distinction, the purpose is only one: once the new online system has problems, can immediately remove the gray system, and during this period any user modification can be found on the old system.

Four,

Some people argue that grayscale publishing is a waste. But this is not so much waste as redundancy and flexibility, gray release can avoid the risk of the new version of the full online, through the way of small flow verification, in the gray stage can find, adjust and optimize the problem in the product, smooth iteration. At the same time, all the relevant data should be collected, such as the stability of the new version, the stability of the server, the frequency of use, the frequency of use and all kinds of data, so as to facilitate comparison with the original data before.

Some people may feel that grayscale release is completely unnecessary and a waste of resources. Grayscale release is very useful. The purpose of doing so is not only to understand the most real user experience but also to effectively prevent major bugs from affecting system refiles or causing other unnecessary economic losses. Therefore, grayscale release is an effective way to effectively avoid the risk of the launch of the new version, which can be tested first through small flow to help the smooth iteration of the new version.