当前位置:网站首页>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
边栏推荐
- C1 notes [task training part 2]
- 2022江西光伏展,中国分布式光伏展会,南昌太阳能利用展
- ES6
- How to install jsonpath package
- 极致体验,揭晓抖音背后的音视频技术
- Process management command
- Crack sliding verification code
- Install pyshp Library
- [UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
- Nat commun | current progress and open challenges of applied deep learning in Bioscience
猜你喜欢

Operation of 2022 mobile crane driver national question bank simulation examination platform

Operators in C language

2022 Jiangxi Photovoltaic Exhibition, China Distributed Photovoltaic Exhibition, Nanchang Solar Energy Utilization Exhibition

Docker 安装 MySQL

C language loop structure program

开源按键组件Multi_Button的使用,含测试工程

Clion installation tutorial

Summary of floating point double precision, single precision and half precision knowledge
![解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]](/img/5f/a80951777a0473fcaa685cd6a8e5dd.png)
解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
![[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)](/img/ae/cbfc01fbcc816915b1794a9d70247a.png)
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
随机推荐
MySQL 中的字符串函数
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
Use of list - addition, deletion, modification and query
Crack sliding verification code
Summary of common server error codes
k8s之实现redis一主多从动态扩缩容
ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
列表的使用-增删改查
Build openstack platform
_ FindText error
xlsxwriter. exceptions. Filecreateerror: [errno 13] permission denied
Transfer learning of five categories of pictures based on VGg
Process management command
The ultimate experience, the audio and video technology behind the tiktok
.104History
Utilisation de la liste - Ajouter, supprimer et modifier la requête
cv_ Solution of mismatch between bridge and opencv
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
Flash - Middleware
Examination question bank and online simulation examination of the third batch (main person in charge) of special operation certificate of safety officer a certificate in Guangdong Province in 2022