In the previous article, I learned how to use tools to pressure test the performance of our interface. If it does not meet our performance requirements, how to optimize it?
Consider many aspects
(1) Database : Is database operation fast or not, SQL performance is high or not?
(2) Application : Are there any problems with the code, and can it be optimized?
(3) Middleware : For example, our mall system, from nginx to gateway to tomcat, are all points we consider optimization
(4) Network and operating system, etc .: For example, the network speed is slow, the server pressure is high, and the bandwidth is only 1M. For example, there are 10,000 requests, each sending 1k of data, and there are also
10m, so bandwidth congestion will also be the cause of the throughput performance, and it is also possible that the operating system is different, and its processing of the kernel is also different, which will also affect
Regarding the optimization of the application, regardless of the above influences, we must first consider whether it is CPU-intensive or IO-intensive
IO intensive: data transfer between networks, disk read and write, read and write from the database, read and write data from redis
Generally replace the solid state hard disk, add memory stick, improve the transmission efficiency of the network card
CPU intensive: For example, if we find some data, we need to filter, sort and calculate, etc., through the background we can see that the cpu soars, this is cpu intensive
Generally upgrade the server, add CPU, or add server, do parallel processing
So in addition to performance indicators, we also need to see some monitoring indicators, such as CPU usage, memory usage, etc., which will be discussed in the next article