With the growth of traffic, there are more and more service nodes, and the requirements for service performance are also increasing. It is often found that there is jitter when the service is started. For these service jitter, some predictive measures need to be taken. The following is a brief introduction. System-related service preheating, middleware preheating, database preheating, etc.
Warm up the scene
In the "springcloud online publishing timeout" series of articles, some service resources that need to be warmed up for microservices have been described.
- connection pool
- Thread Pool
- Limiting Pool
- grpc connection
Let’s talk about jit here. There are two options on the Internet.
Solution one customized jdk
Save the jit process information to a file and load it automatically when you publish it next time. The mature solution is Ali’s jwarmup, which has been integrated into Ali’s jdk. If you are interested, you can learn about it.
Program two run test case warm-up
Generally, test case preheating is used. If it is only jdk preheating, you can directly run a few test case cycles n times, but if it involves middleware preheating, this may not meet the demand.
I now use traffic recording and playback to warm up, as shown below:
Solution 3: Customize the routing strategy and route through tag configuration
The solution here is to customize the routing strategy. When the service is just started, it is registered with some configuration information. The gateway or service invocation section obtains the configuration and then routes according to the configuration. First, a small amount of traffic is routed, and then it is slowly increased until the route is 100%. Can achieve the preheating effect for jit
First, many services use redis in order to improve throughput. This will cause all requests to be sent to the db after the service is started or after the redis data is lost, which causes the pressure of the db to double, which is a common redis avalanche.
CDN often also assumes the entry cache, so preheating is also required here, and production traffic playback can be recorded to achieve the preheating effect.
mysql warm up
The performance of mysql is very poor for more than ten minutes after restarting. The reason is that InnoDB has an innodb buffer pool. For details, please refer to this link: https://blog.csdn.net/u014236541/article/details/79870670