I wrote a grayscale gadget myself

What is grayscale publishing?

Please add image description

concept

Grayscale publishing (also known as canary publishing) refers to a publishing method with a smooth transition between black and white . A/B testing can be carried out on it, that is, let some users continue to use product feature A, and some users start to use product feature B. If users have no objection to B, then gradually expand the scope and migrate all users to B. Come. Grayscale release can ensure the stability of the overall system, and problems can be found and adjusted in the initial grayscale to ensure their influence.
Grayscale period: The period from the beginning to the end of the grayscale release is called the grayscale period.

effect

  1. Obtain feedback from users early, improve product functions, improve product quality, allow users to participate in product testing, and strengthen interaction with users to reduce the scope of users affected by product upgrades
  2. Ensure the stability and security of the system. If it is directly released in full, if there are bugs, it will affect all users, and if it is released in grayscale, even if the newly launched content has bugs, the impact on users is controllable.

step

1) Define the target
2) Selected strategy: including user scale, release frequency, function coverage, rollback strategy, operation strategy, new and old system deployment strategy, etc.
3) Screening users: including user characteristics, number of users, common functions of users, user Scope, etc.
4) Deployment system: deploy new system, deploy user behavior analysis system (web analytics), set diversion rules, analyze operational data, fine-tune diversion rules
5) Release summary: user behavior analysis report, user questionnaire, social media Collect opinions and form a product function improvement list
6) Product improvement
7) A new round of grayscale release or complete release

testing method

Grayscale publishing seems to be similar to A/B testing commonly used by Internet companies. Foreign Internet companies do not seem to have the concept of so-called grayscale publishing. According to the definition of A/B testing in wikipedia, A/B testing is also called: A/B/N Testing, Multivariate Testing, so essentially grayscale testing can be regarded as a special case of A/B testing. Just in order not to confuse the terminology, I will talk about the difference between the two that I understand.

  • Grayscale release is the release of a certain product to gradually expand the scope of the user group, also known as grayscale release
  • A/B testing focuses on choosing the best option among several options

Grayscale publishing engine

For general small systems, a separate grayscale publishing engine is not required. You can refer to the practice in A/B testing and implement the rules of shunting on the page JavaScript or server side. But for large-scale Internet applications, a separate publishing engine for managing user traffic is necessary.
Please add image description

common problem

generalize

1) Problem characteristics:
a. The selected sample is not representative;
b. The sample is representative, but the user's usage habits of the selected sample do not cover all core functions
2) Solution:
The sample selection should be diversified, and the combination of samples covers most of the core functions Features

the curse of knowledge

The saying "Curse of Knowledge" comes from the experiment in "Stick", you can search for it yourself. We are very familiar with the products we have developed, so we take it for granted that users should be able to understand the design ideas of the products and the functional use of the products, but in fact, the ideas of users and developers may be completely different
1) Problem characteristics:
a The results are not quantified means;
b only rely on user questionnaires;
c no web analytics system; d operation data is not comprehensive ,
only core business indicators (such as transaction volume), no user experience indicators
Others turn a blind eye
2) Solutions:
a Product design considers product quantitative indicators
b Results analysis is based on quantitative indicators rather than feelings

There is no turning back for publishing

1) Problem characteristics:
a. The user habits of the old and new systems are too different, and the original functions are not compatible.
b. The old and new systems cannot run in parallel due to the large differences in functions. The new system can only be forced to upgrade
. c. To fully use all functions, it is necessary to switch between the
old and new systems. The database data structure of the old and new systems is too different to run in parallel.
2) Solution:
The early product planning focuses on these issues, including:
rollback plan, compatibility plan between old and new systems, user experience Consistency, continuity of user habits, compatibility of old and new system data models

Insufficient user engagement

1) Problem features:
a) Count on users to dig out all the functions by themselves. For a product, most users often only use some functions, and most users are lazy and will not take the initiative to explore product functions
b single interaction channel
c fall into the "curse of knowledge" and disrespect participating users' opinions
2) Solutions:
a Be kind to sample users who eat crabs, including giving small rewards to users who participate in the test (for example, MS gives genuine licenses to users participating in the Win7 test), and giving users title
b to interact with users through new media such as emails, forums, communities, Blogs, and Twitter.
cProvide product function guide. In hotmail's recently upgraded feature tip, gmail's tip has similar product feature orientation. There will be prompts in the product similar to: Did you know that xx also provides xx functions, through which you can xx.
Please add image description

Grayscale Publishing Example

***Gmail Labs*** is a new feature window. Users can choose some new features that have not been officially released to experience it. If they don't like it, they can close it. In the process, they ate crabs and became Google's guinea pigs.
This approach is much smarter than the traditional grayscale, and it respects users more:
1. It does not impose users, whether users are willing to be guinea pigs completely voluntarily
2. The new features are not a big version packaged together, you can choose a few favorites Try the crab
3. If the crab is not delicious, you can throw it away. You don’t have to eat it hard to cause gastroenteritis.
Of course, these benefits also come at a price:
1. To develop a labs platform to realize the functions of new features and independent attempts, this may require Change the front-end and back-end architecture of Gmail
2. New features must be written according to certain specifications before they can be published on this platform, which may increase some workload
3. After the number of guinea pig users increases, the pressure on the system may increase to a certain extent, because every A user invoked a different interface
Now that Gmail Labs can successfully launch, it means that for Google, these problems are not a problem. In addition, the new features displayed now are marked with the developer's name. So, Gmail Labs may open this platform so that external developers can also submit features? This is a very open development model, which is very suitable for Google's web app product line.
One of the characteristics of Internet products is that they are constantly upgraded, upgraded, and upgraded.
In order to avoid these risks, many products have adopted the strategy of grayscale release. The main idea is to concentrate the influence to one point, and then spread it out to one side, and it is easy to roll back in the event of an unexpected situation.

QZone is another example of publishing in grayscale. As we all know, QZone has improved tremendously in the past year, from a slow old grandfather to a young man full of youthful energy. Among them, they have experienced countless releases, and their releases also adopted the strategy of gray release. The upgrade of user data is not a one-time upgrade in a large area, but through a user upgrade to mark the server. If the user data is not upgraded , the background will gradually migrate the user's data to the new version, and then set the upgrade flag to 1. During the upgrade process, the user can still access the old data, and the access after the upgrade is completed will be forwarded to the new version.
Many of QQ's product releases are released in grayscale, and some are upgraded to the new system by extracting part of the QQ number segment, and then upgrading on a large scale based on user feedback.
In the traditional software product release process (such as Microsoft's Windows 7 release process), it generally goes through several stages such as Pre-Alpha, Alpha, Beta, Release candidate (RC), RTM, General availability or General Acceptance (GA). (Refer to Software release life cycle). It can be seen that the release stage of traditional software is from the company's internal -> external small-scale testing> external large-scale testing -> official release, and the number of users involved is also a process of gradually increasing volume. This kind of release method is also widely used in the release process of Internet products: the release process of products is not done overnight, but gradually expands the scope of users, from internal users of the company -> torrent users with higher loyalty -> a wider range active users of -> All users. During this process, the product team improves product-related functions in a timely manner based on user feedback. This kind of release method is called "grayscale release", "grayscale release", and "split release" according to the Chinese characteristics.
There is no way to investigate the origin of the so-called "grayscale release". But according to the traditional Chinese philosophy, it is in line with the Chinese mode of thinking: all things in nature always exist in the form of symmetry, complementarity and harmony, such as black and white, yin and yang, positive and negative, blessings. with calamity. There is a stage of mutual transition between the elements of binary opposition, the so-called "disaster and blessing depend on, and blessing and disaster lie in".Specific to black and white, there is an intermediate color between black and white - gray. So there are a lot of sayings about gray: gray box testing, gray management (highly recommend Ren Zhengfei: gray management), gray income, gray areas, and so on. Therefore, grayscale release is actually a process of gradually transitioning from unreleased to official release.

Grayscale Widget Code & Instructions

Enter the topic, it is this grayscale gadget.
Please add image description

effect

The function is simply to perform grayscale according to the user's id tail number (of course, other ids, such as commodity ids, etc.), to determine whether the specified id is within the grayscale range.

code

public class GrayUtil {
    
    

    private static final BusinessLogger LOGGER = TLoggerFactory.getBusinessLogger(GrayUtil.class);

    // 尾号区间只有两个数
    private static final int ID_SUFFIX_SPLIT_COUNT = 2;

    // 百分位
    private static final int PERCENTILE_SIZE = 2;

    // 千分位
    private static final int THOUSANDS_SIZE = 3;

    /**
     * 独立实现的灰度规则(支持尾号单个匹配,如1,2,3,4,5)
     *
     *
     * @param id           用户id
     * @param grayIdSuffix 后缀 例如:"1,2,3",代表最后一位为1,2,3会命中灰度
     * @return true代表在灰度内,false代表在灰度外
     */
    public boolean hitGrayIdSuffixWithSingle(Long id, String grayIdSuffix) {
    
    
        try {
    
    
            if (Objects.isNull(id)) {
    
    
                return false;
            }

            double pow = Math.pow(10, 1);
            String idSuffix = id % (int) pow + "";
            ArrayList<String> grayIdSuffixes = new ArrayList<>(Arrays.asList(grayIdSuffix.split(",")));
            return grayIdSuffixes.contains(idSuffix);

        } catch (Exception e) {
    
    
            return false;
        }
    }

    /**
     * 独立实现的灰度规则(支持尾号范围匹配,如00-99)
     *
     * @param id
     * @param grayIdSuffixSize 灰度规则区间支持位数,如2,支持grayIdSuffix定义尾号两位的区间
     * @param grayIdSuffix     灰度规则单区间,如:00-23 配合grayIdSuffixSize=2,即尾号为00到23的id区间
     **/
    public boolean hitGrayIdSuffix(Long id, int grayIdSuffixSize, String grayIdSuffix) {
    
    
        try {
    
    
            if (Objects.isNull(id)) {
    
    
                return false;
            }

            // 灰度区间
            if (StringUtils.isNotBlank(grayIdSuffix)) {
    
    
                String[] split = grayIdSuffix.split(Constant.LINE);
                if (split.length < 1 || split.length > ID_SUFFIX_SPLIT_COUNT) {
    
    
                    return false;
                }
                int start = Integer.valueOf(split[0]);
                int end = start;
                if (split.length == ID_SUFFIX_SPLIT_COUNT) {
    
    
                    end = Integer.valueOf(split[1]);
                }
                Double pow = Math.pow(10, grayIdSuffixSize);
                int idSuffix = (int) (id % pow.intValue());
                if (start <= idSuffix && idSuffix <= end) {
    
    
                    return true;
                }
            }
        } catch (Exception e) {
    
    
            LOGGER.error(BusinessLogSchema.of().message("hitGrayIdSuffix error,id is{},grayIdSuffixSize is {},grayIdSuffix is {}.",
                    id, grayIdSuffixSize, grayIdSuffix).exception(e));
            return false;
        }
        return false;
    }
}

Test Results (How to Use)

Interval-type grayscale rules (for example, ids with tail numbers 1, 2, 3, and 4 enter the grayscale) test:

    @Test
    public void test08() {
    
    
        // 灰度小工具
        System.out.println(hitGrayIdSuffixWithSingle(965006065497711336L, "2,8"));
    }

Continuous grayscale rule (for example, the id ending in 00-05 enters the grayscale) test:

    @Test
    public void test09() {
    
    
        // 灰度小工具
        System.out.println(hitGrayIdSuffix(965006065497711336L, 2,"00-05"));
    }

Note: The second parameter (2) represents the range of the tail number, such as 00-05, which is two digits; 000-123, which is three digits;

Guess you like

Origin blog.csdn.net/GBS20200720/article/details/124272740