Performance Testing-Main Directions and Principles of Performance Tuning (15)

Main Directions of Performance Tuning After the performance bottlenecks are identified, performance tuning needs to be performed. Tuning mainly starts from the multiple directions shown in the figure. Optimization means are not necessarily applied independently, and multiple optimization techniques are likely to be applied in an optimization process.

Hardware level optimization

Hardware-level optimization is more focused on monitoring. When hardware resources are identified as bottlenecks, capacity expansion and other means are often used to solve the problem. 

Software level optimization

Take java language as an example

(1) Reduce the number of requests and compress the size of static resource files

1) Reduce the number of times the client requests static resources. Reduce the number of client requests by caching locally on the browser or App side.

2) Compress resource file size.

3) Use CDN technology.

4) Reduce the number of service requests. For some client pages that need to be refreshed in real time, reduce the number of requests to the server by reducing the refresh frequency. As the business continues to be updated and iterated, the system may generate some redundant logic, causing additional and unnecessary requests to the server. For these requests, optimization needs to be combined with the business.

5) Reduce the number of database accesses

6) Reduce the number of interactions through Redis batch commands or pipelines

(2) Lightweight objects

To solve this problem, it is necessary to strictly control it from the design stage to make objects lightweight, which can significantly improve the situation of frequent GC and high bandwidth usage.

(3) Object reuse

(4)IO optimization

As mentioned earlier, among the four core hardware resource indicators of CPU, memory, disk IO, and network IO, disk IO is the most likely to become a bottleneck. Therefore, increasing the speed of disk IO is of great benefit to improving the overall performance of the system. . NIO replacing IO is a common IO optimization method.

Change the stream-based IO implementation (processing data in bytes) to a block-based IO implementation, adding a buffer &

Guess you like

Origin blog.csdn.net/seanyang_/article/details/132921253