In general, your young generation should be 1/4 to 1/3 the size of your heap. I usually also recommend setting the heap min and max to the same size.
Considering the size of your heap, a 4 second garbage collection is very normal (I have see 20 seconds with heaps that size). Setting the young generation size should help because then fewer objects will get tenured, which will reduce the number of times a full collection gets run.
Thanks Peter! So you set Xmx=Xms? I've read at the java tuning that this reduces the flexibility of the GC, would this cause any problems?
So something like this: Xms2520m Xmx2520m -XX:NewRatio=3
Also, having a bigger eden (-XX:NewRatio=2) wouldn't reduce the number of minor collections?
Would it be a good practice to turn off explicit GC (-XX:+DisableExplicitGC) for RMI purposes and also other libs that people insist in doing System.g()?
Also should i set the client interval though -Dsun.rmi.dgc.client.gcInterval=3600000 ?
Considering the size of you heap and GC times you may consider something like Azul Systems.
I have never encountered problems setting min and max heap to the same size. Of course, I typically run on systems dedicated to the app server. If you run a mixed environment (other apps besides the app server) and the load on the app server changes over the course of the day ( example: app server heavily used during day but mostly quiet at night , but at night you have batch jobs running) you might want to set the sizes to different values so that the JVM can release memory space to other apps that might need it.
Setting the eden ratio to 2 is not a good idea. You will end up with only full collections because when the JVM runs out of eden space, it makes a worst-case assumption that all the objects in eden will end up in the tenured generation, and if there is not enough run on the tenured generation it will do a full collection. Simplified example: tenured gen is 400MB, young gen is 400MB. Tenured gen has one object of 32 bytes in size. Eden is full, 400MB is greater than 400MB - 32 bytes, so full GC happens.
Yes, turn off explicit gc, and set the client interval (later already set in the jboss bat/shell scripts).