当前位置:网站首页>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
边栏推荐
- The method of changing a value in the array and a value in the object of wechat applet
- 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
- Nanotechnology + AI enabled proteomics | Luomi life technology completed nearly ten million US dollars of financing
- Crawl the product data of cicada mother data platform
- journal
- How to install jsonpath package
- Docker 安装 Redis
- The ultimate experience, the audio and video technology behind the tiktok
- Crack sliding verification code
- Excel opens large CSV format data
猜你喜欢
C1小笔记【任务训练篇二】
Open source key component multi_ Button use, including test engineering
Implementation of object detection case based on SSD
The ultimate experience, the audio and video technology behind the tiktok
Docker 安装 MySQL
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
An example of linear regression based on tensorflow
极致体验,揭晓抖音背后的音视频技术
Go对文件操作
ArcGIS table to excel exceeds the upper limit, conversion failed
随机推荐
Halo open source project learning (II): entity classes and data tables
Yolov4 pruning [with code]
[UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)
Notes on common basic usage of eigen Library
Nat commun | current progress and open challenges of applied deep learning in Bioscience
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
Cloud native Virtualization: building edge computing instances based on kubevirt
k8s之实现redis一主多从动态扩缩容
ES6
Crawling mobile game website game details and comments (MQ + multithreading)
消费者灰度实现思路
开源按键组件Multi_Button的使用,含测试工程
GDAL + ogr learning
Fashion classification case based on keras
Go对文件操作
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
cv_ Solution of mismatch between bridge and opencv
纳米技术+AI赋能蛋白质组学|珞米生命科技完成近千万美元融资
.104History
C network related operations