table of Contents
background
From here on the last part of the JVM notes-performance tuning, including tuning tools (command line tools, gui tools), JVM parameters, log analysis, this article is the beginning
Tuning trilogy
problem found
Frequent GC, high CPU load, OOM, memory leak, deadlock, too long response time (ANR)
Troubleshoot
1), print GC log, analyze through GCViewer or http://gceasy.io
2), use jstack, jmap, jinfo and other command line tools
3), dump out the heap file, and analyze
4) Use Arthas, jconsole or JVisualVM to view the JVM status in real time
5), jstack view stack information
Solve the problem
1) Appropriately increase memory and choose a collector
2), optimize the code, control memory usage
3), increase the machine, load balance
4), reasonably set the number of threads in the thread pool
5) Use middleware to improve program efficiency, such as caching, message queues, etc.
Test index
Response time
The time used between submitting the request and getting the returned result. In GC, the pause time refers to the time when the worker thread of the program is suspended (STW) when the GC is executed
Throughput
The amount of work completed per unit of time. In GC, throughput refers to the ratio of the time running user code to the total running time, involving the parameter -XX:GCTimeRatio=n, throughput=1-1/(1 + n)
Concurrency
The number of requests that actually interacted with the server at the same time
Memory footprint
The size of the memory occupied by the java heap
Mutual relationship
As the number of concurrency increases, response time will decrease, and throughput will increase first and then decrease; JVM performance tuning mainly focuses on response time and throughput