Part v Performance tuning
Performance bottleneck symptoms:
1. Excessive resource consumption and insufficient performance of external processing systems
2. Low resource consumption, but insufficient program response speed
About CPU usually use time slice, multi-core method to achieve the CPU segmentation; Each CPU core runs a runnable thread queue; Thread is the basic unit of processor scheduling.
Tuning methods: hardware, operating system, JVM and program.
The JVM optimization: blog.csdn.net/wangnayu/ar… The idea of setting up the JVM parameter https://www.cnblogs.com/marcotan/p/4256885.html JVM parameter a. Set the size of each generation properly b. Select an appropriate GC policy
Program optimization: CPU consumption serious CPU US high cause: the execution thread does not have any suspend action, has been executing occupy resources, leading to the phenomenon of thread starvation. To reduce CPU consumption, add thread. sleep to this Thread.
CPU sy is high because the running state of threads needs to be changed frequently. Solution: Reduce the number of threads
File I/O consumption serious cause: Multiple threads write a large amount of data to the same file. Solution: Asynchronous file writing, batch read/write, and stream limiting
Cause: Too many packets need to be sent and received at the same time. Solution: Limit traffic, such as sliding Windows
Cause of severe memory consumption: Consuming too much JVM heap memory, resulting in frequent GC execution solutions: releasing unnecessary references, using object cache pools, using proper cache invalidation algorithms, and using soft and weak references properly