当前位置:网站首页>Microservice test efficiency governance
Microservice test efficiency governance
2022-06-22 13:40:00 【51CTO】
Under the microservice service structure , The third-party services that microservices rely on 、 More and more data , It brings many difficulties to the traditional testing methods , For example, the dependent offline services are unstable ; The service cannot provide the expected response data ; Lack of test scenario construction standards, etc . To address these issues , The general idea is to improve the stability of the test environment 、 Build your own test data and test scenarios , Improve the certainty and effectiveness of testing , But these methods can not fundamentally solve the problem . such as , Service instability is still unavoidable , Changing the code injection object is not only complicated, but also very error prone , And there is no certain basis , The constructed test scenarios are not sufficient , indecisive .
One 、 Traffic recording playback test
In view of the above shortcomings of microservice testing , Try a traffic recording and playback solution , Record the real online traffic in a certain way , Playback offline . During offline test , The online playback traffic can flexibly test the respective functions of the service , You can also edit and modify based on playback traffic , For the third-party requests that the service depends on mock And customization , Make code development simple and convenient , And it can be changed and measured at any time , solve RD Inconvenient development 、 The self-test process is too long .
The recorded traffic should include the service request / Return traffic , And the third-party interactive traffic that can be associated with it . If there are only service requests / Return traffic , Can only be used in query class read-only systems , The scope of application is limited ; If the third-party interaction cannot be properly associated with the request , These flows cannot be applied correctly .
To solve the problem of traffic correlation , One solution is to Flow rectifier , Serialize it . A machine that parallels the online services , Control the traffic it receives , Reduce the traffic of its service to serial , And the interval between flows is certain ( To allow time for asynchronous third-party requests ), So these traffic requests / The response is automatically associated with its third-party interaction traffic .
How to associate requests with third-party interaction traffic , Requests can be associated with traffic to third-party system calls based on distributed tracing technology . However, the difficulty of this method is that not all third-party interaction traffic has a request tracking id . Another idea is to intercept system calls at the language level , Associate the request with a call to a third-party system .
Two 、 Simulation environment test
As an online service , In order to meet the gray-scale publishing 、 Testing and other multidimensional requirements , It is generally necessary to support flexible diversion strategies , Schedule traffic to different environments . In order to support fine grayscale publishing strategy , Online traffic needs to be diverted to small traffic clusters according to certain rules , In order to support high simulation test using real traffic , It is also necessary to introduce certain traffic into the simulation environment according to policy rules .
The characteristic of small traffic diversion is that the traffic is sent to small traffic clusters , No more processing , Wait directly for the return result of the small traffic cluster , Then forward the result to the calling side . The characteristic of simulation environment shunting is that the traffic sent to the simulation environment is only one “ shadow ” Traffic , amount to Oneway request ( No reply message is required ), There is no impact on the business process , It is the same as the case without simulation environment .
Simulation environment support can be carried out at the service framework level , In order to realize the routing and forwarding based on the request content , The framework acts as a Proxy Role , After the request is parsed, it is sent to the downstream environment . Based on the characteristics of simulation traffic , In order not to have an impact on the business , The timeout for sending to the downstream simulation environment can be set very small , Even if some traffic times out, it doesn't matter , At the same time, in order to realize the processing of simulation environment under the framework of automatically generated code Oneway effect , You can customize a transport layer , The specific implementation of this transport layer does not handle anything , Just throw it away .
边栏推荐
- SQL and Oracle statements for eliminating duplicate records
- leetcode LCP 10. Binary tree task scheduling
- leetcode-背包问题
- SSM based community garbage classification and transportation management system, high-quality graduation thesis example (can be used directly), source code, database script, project introduction and o
- 241. Different Ways to Add Parentheses
- Secondary development of robotframework -- socket push real-time log
- 241. Different Ways to Add Parentheses
- 在CSDN写文几年,我出了“第一本书“,感恩!
- [cloud native] event publishing and subscription in Nacos -- observer mode
- RobotFramework二次开发——Socket推送实时日志
猜你喜欢

130. Surrounded Regions

openGauss内核分析之查询重写

Leetcode 297 match de la semaine

Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology

46. Permutations

Uninstall MySQL 8

Windows下MySQL 8.0.29的详细安装教程,解决找不到VCRUNTIME140_1.dll、plugin caching_sha2_password could not be loaded

PHP反序列化&魔术方法

Istio服务网格中的流量复制

Eureka的InstanceInfoReplicator类(服务注册辅助类)
随机推荐
leetcode 829. Sum of continuous integers
190. Reverse Bits
Writing a contract testing tool from scratch -- database design
leetcode 968. Monitoring binary tree
Performance of recommender algorithms on top-N recommendation tasks
Acwing game 55
448. Find All Numbers Disappeared in an Array
基於SSM的小區垃圾分類和運輸管理系統,高質量畢業論文範例(可直接使用),源碼,數據庫脚本,項目導入運行視頻教程,論文撰寫教程
Redis active / standby configuration dockercompose version
leetcode 1579. 保证图可完全遍历
Record the solution of failing to log in after the alicloud ECS instance is restarted (hands-on practice)
257. Binary Tree Paths
HMS Core新闻行业解决方案:让技术加上人文的温度
Triggers in MySQL
【Nacos云原生】阅读源码第一步,本地启动Nacos
leetcode 99. Restore binary search tree
redis主备配置dockercompose版
别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
Secondary development of robotframework -- file parsing
卸载MySQL 8