当前位置:网站首页>Realization of consumer gray scale
Realization of consumer gray scale
2022-04-23 18:02:00 【eeaters】
- Grayscale Publishing
- nepxion Implementation logic of synchronization
- Asynchronous implementation ideas
- advantage
- shortcoming
- Detail implementation
Grayscale Publishing
Grayscale publishing is also called Canary publishing , Allow some users to use the new functions after they are released , If the function is normal , Then switch to full users , At present, the most widely used in China is nepxion This framework
Our company is from 2019 The framework was introduced in , The most direct change is :
- You don't have to stay up all night for the release of new features
- The number of accidents due to the introduction of new functions has decreased significantly
However, the framework currently supports gray-scale publishing of synchronous scheduling , There is no gray scale for asynchronous consumption information , With the popularity of gray in the whole company , The demand for gray scale of consumers is becoming stronger and stronger
nepxion Implementation logic of synchronization
Firstly, the synchronous gray-scale scheduling is simply sorted out :
- Premise of synchronous scheduling -- All services are registered in the same registry -- When registering a service, you can identify whether the current service is a grayscale instance or a normal instance , Such as eureka Allow custom extensions when registering a service metadata -- Whether it's RestTemplate still Feign, Must be scheduled by service name
- Invoked procedure -- Service discovery allows instances to be aware of other instances registered in the registry , Include meta information of the instance -- adopt loadbalance Before the service is invoked, it will enter the top note interceptor. ,serviceName→ip:port There will be instances for filtering -- Return the service instance address corresponding to the service name , call http request
At present, the grayscale of consumers is not directly provided , Maybe the author is for commercial reasons , Or not satisfied with some existing schemes , Not meeting your expectations .
Asynchronous implementation ideas
- Grayscale consumer Not with mq Establishing a connection , But it will expose a web Interface
- Non grayscale instances will be associated with mq Establish a channel , Message consumption first goes through a layer of section , In the aspect, the message body will be judged , Indirect consumption , Gray level calls the of gray level instance web Interface
advantage
- Simple
- Can make full use of the logic of the original framework , If anything goes wrong with the original framework , Because the gray judgment is the same , Therefore, direct adaptation
shortcoming
- mq Will achieve reliable delivery , however web There is no guarantee of reliable consumption
- At present, the project is a platform product , So here comes the question , What kind of users will first bring grayscale ? The answer is unimportant , Therefore, because web The call caused the message to be lost ( The probability is very low ) Acceptable , Also made a log record
Detail implementation
Although the code has been written and has been used by some project teams , But as a company asset , Still don't provide code , Just a few details about the implementation
- Grayscale instances expose a web Use it directly here springmvc Of handlerMapping Interface ( Actual reference spring-boot-actuator Part of the code ), Scan all @RabbitHandler; You can use the name of the queue as web Of url; The implementation will be simple , No changes need to be made in the code of the project
- Consumers are forwarding web After the interface , Can send a successful / Failed Events , This avoids the problem that some projects think all messages cannot be lost
- spring-rabbit Not found and mebmvc The same local thread variable holds the request , either webmvc So there's a preprocessing ( This is )+ Post processing ( This is not. ) This collocation , So here will be for the message sent , Define a data structure , Such as upstream header Equal gray dependent parameters are packed in . There will be some intrusion into the code . such as :
/**
* The upstream request Of header Information
*/
private final Map<String, String> headers = new HashMap<>();
/**
* Additional information
*/
private Map<String, Object> extraData;
/**
* The information actually to be sent
*/
private T data;
版权声明
本文为[eeaters]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231758599181.html
边栏推荐
- re正则表达式
- Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
- [UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
- Crawl the product data of Xiaomi Youpin app
- Re regular expression
- ArcGIS license error -15 solution
- ES6
- C# 网络相关操作
- C byte array (byte []) and string are converted to each other
- Secure credit
猜你喜欢
Jenkspy package installation
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
Gaode map search, drag and drop query address
Cross domain settings of Chrome browser -- including new and old versions
In JS, t, = > Analysis of
Detailed deployment of flask project
C# 的数据流加密与解密
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (1)
Go file operation
随机推荐
Encapsulate a timestamp to date method on string prototype
ES6
ES6 face test questions (reference documents)
Flask项目的部署详解
Yolov4 pruning [with code]
Read excel, int digital time to time
C [file operation] read TXT text by line
Operators in C language
Laser slam theory and practice of dark blue College Chapter 3 laser radar distortion removal exercise
云原生虚拟化:基于 Kubevirt 构建边缘计算实例
Anchor location - how to set the distance between the anchor and the top of the page. The anchor is located and offset from the top
xlsxwriter. exceptions. Filecreateerror: [errno 13] permission denied
Nat commun | current progress and open challenges of applied deep learning in Bioscience
Docker 安装 MySQL
Vite configure proxy proxy to solve cross domain
Secure credit
Welcome to the markdown editor
JS high frequency interview questions
Submit local warehouse and synchronize code cloud warehouse
Docker 安装 Redis