Reputation: 31
i have a Java web application,when the JVM makes a FGC,there is no more memory left,then swap will be used, and the load is growing fast. And i can't undersatand why,anybody could help me?
Upvotes: 1
Views: 171
Reputation: 9028
Enable Full GC logging so you can see what is happening in your Heap.
Use -XX:+PrintTenuringDistribution -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log -XX:+HeapDumpOnOutOfMemoryError -Xloggc:gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -showversion
Upvotes: 0
Reputation: 38536
Either your Java heap size is too low for the working set of data you are processing, or you have a memory leak which is consuming the memory that could otherwise be used for useful processing.
Your first point of attack could be to use a profiler to understand exactly what is consuming memory. JVisualVm is a somewhat bare-bones but competent profiler. From there, you can make decisions about whether you need to allocate more memory (via -Xmx
VM arguments), fix memory leaks, or make algorithmic improvements.
Upvotes: 1
Reputation: 123668
You seem to have set the maximum heap size (-Xmx)
high enough that the JVM doesn't have any memory left for garbage collection. As such, the system runs out of RAM and starts swapping to disk.
You can begin by either reducing -Xmx
or adding some RAM to your system and figure what's making your app consume so much memory.
Upvotes: 2