Performance testing - memory overflow (heap overflow, stack overflow, persistent generation overflow) problem location and analysis [Hangzhou multi-tester_Wang sir] [Hangzhou multi-tester]...

1. Heap memory overflow
1) After a period of stability pressure testing, jmeter reports an error, and the log reports java.lang.OutOfMemoryError.Java heap space.
2) Use the jmap -histo pid command to dump the heap memory usage, and check the top 20 objects in the heap memory to see if there is a method for your own application, starting from the highest one, and if so, check what causes the heap memory for this method overflow.
3) If there is no own method in the top 20, use jmap -dump to dump the heap memory, then use MAT to analyze the dumped heap memory, and analyze the method of exporting memory overflow.
4) If there is no problem with the application method, you need to modify the JVM parameters, modify xms, xmx, adjust the heap memory parameters, and generally increase the heap memory.


2. Stack memory overflow
1) After a period of stability pressure testing, jmeter reports an error, and the log reports Java.Lang.StackOverflowError.
2) Modify the jvm parameter, increase the xss parameter, and increase the stack memory.
3) The stack overflow must be caused by batch operations, so reduce the amount of batch data.
3. Persistent generation overflow
1) After a certain period of stability pressure testing, the log reports Java.Lang.OutOfMemoryError.PermGen Space.
2) The reason for this is that there are too many static variables such as classes, method descriptions, field descriptions, constant pools, and access modifiers, which will fill up the persistent generation and cause the permanent generation to overflow.
3) Modify the jvm configuration and increase the XX:MaxPermSize=256 parameter. Minimize static variables.
4. Thread deadlock
1) After capacity test and pressure test for a period of time, LR reported that the connection timed out.
2) There are many reasons for this phenomenon, such as insufficient bandwidth, insufficient middleware thread pool, insufficient database connection pool, full number of connections, etc. will cause the connection to fail and report a timeout error.
3) The jstack command dumps the thread stack, and searches for blocks in the thread stack. If there is, it is a thread deadlock. Find the deadlocked thread and analyze the corresponding code.
5. Database deadlock
1) After capacity test and pressure test for a period of time, LR reported that the connection timed out.
2) There are many reasons for this phenomenon, such as insufficient bandwidth, insufficient middleware thread pool, insufficient database connection pool, full number of connections, etc. will cause the connection to fail and report a timeout error.
3) Search the block in the database log. If the block can be found, there is a database deadlock. Find the log, check the corresponding sql, and optimize the sql that caused the deadlock.

Guess you like

Origin blog.csdn.net/weixin_39362573/article/details/129193198