Search code examples
javagarbage-collectionheap-memoryvisualvm

Is 300-400 MB/min alloc/dealloc rate OK for java gc?


There is a java server-side application. Threads number is up to 1000. The app intensely uses NIO for communication, JINI etc.

Would you consider allocating/de-allocating of 400 megabytes per a minute to be fine (acceptable) for a java application at all?

The reason to ask the question - amount of available memory becomes less as time goes on: there is some memory leaks (several megs per day), also amount of used memory depends on amount of work to do (the app caches some things). So there may be a situation with <= 100 megs of free memory. GC becomes crazy of course, as its activity becomes very demanded. (Recommended running time to restart is a month in production)

Heap allocation statistic from VisualVM


Solution

  • 400 MB/sec of garbage is very bad.

    400 MB/min of garbage may be ok for your application.

    I would try increasing the Eden size via -XX:NewSize= to 1g, 2g or 4g to see if this improves performance.

    I would try to estimate how many active threads you have esp if this is more than the number of CPUs you have.