java gc free the application
Using jmx and monitoring a web application, I notice when th GC (G1) is runnig , all threads are freezed, and the application does not responde. I configured the tomcat jvm in like this:
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+DisableExplicitGC
-Xss2m
-XX:+CMSClassUnloadingEnabled
-XX:+UseG1GC
-Djava.net.preferIPv4Stack=true
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8338
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dhazelcast.logging.type=slf4j
The application doe开发者_如何学编程s not respond when the used heap memory reach the max limit (2GB) and the GC deeply work on memory. After the gc work the used heap goes down to 300Mb. Is it possibile to setup a different way to work for the GC? This is a big problem for my application because I use hazelcast and jgroups and every time the gc works, it cause a paartition of the cluster.
Some special libraries that I use in this web application: 1) hazelcast 1.9.4 2) akka 0.10 3) jersey 1.2
The problem may be as simple as the fact that you need -XX:UnlockExperimentalVMOptions
, since (AFAIK) G1GC is still considered experimental.
There are a variety of other experimental, HotSpot-specific JVM args you can play around with if that doesn't do the trick:
-XX:+UseParallelGC
-XX:+UseConcMarkSweepGC
- etc...
See http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html.
精彩评论