Reputation: 20986
After working on performance of a java 8 application, there was increased count of JMS consumer threads which increased parallel processing, bigger part of which is parallel requests to DB. Application started to use more memory. It was given more memory but side effect started to appear. After 2-3 batches of input messages under high load (productivity increased much) garbage collection started to use CPU intensively. It was not small before because of the nature of the application, text messages processing, intensive creation of new (huge) text variables and then garbage collection at the end of the flow. But it clearly seen that it becomes huge at some point of time and application can't get out of this state.
On the picture above it happened at 18:58. Notice memory graph, there are no ordinal 'picks of memory' usage, it is garbage collecting all the time, hence CPU picture. I have seen this before when application lacks of memory and few moments before OOE you can usually see exactly the same picture. It was given another GB of memory but picture didn't change, notice that maximum usage was about 5000 MB, but after this JVM freed half of GB, meaning it is not needed to it. But it behaves like if it lacks of memory.
Worth to mention that there are several JVM started on the same machine cooperating with each other. Another 'big one' is doing preliminary processing and working just fine, having similar architecture but fewer memory consumption.
You can notice 'memory picks' for all three batches for this app, running at the same time.
I googled around and found that it could be Meta Space which may cause extra GC triggering and erratic application behavior, so I intentionally increased max Meta Space size to some bigger value that application is usually take, notice max and used below
Question: what is going on here, what could be the reason of constant GC activity and how could I fix it?
Upvotes: 1
Views: 700
Reputation: 20986
jvisualvm shows all available memory, but doesn't show each space. jconsole showed that at the moment GC becomes constant 'Old Gen' pool became full, at the same time 'Eden Space' and 'Survival Space' could be empty. This explains the situation with constant GC activity when we have free space (dedicated to other generations).
After using G1 GC issue gone, application seems started to use little less memory, memory pics looks smaller (due to different algorithm?)
New java 8 option -XX:+UseStringDeduplication
reduced memory usage for this text processing application, but this is slightly different story.
Upvotes: 1