Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Garbage Collection, Class Based Tenuring

I have been playing with the parameters of the Java Garbage Collector, and I'm seeing expensive and frequent minor garbage collections as the eden/survivor space fills up. This is due to me allocating a pool of very large objects. These objects I know are "permament", in that they are reused but will never be GCed. I'm therefore trying to find a way to "automatically" place objects of these types in the old generation rather than in the new one.

I'm currently getting around this issue by allocating a very large new generation (to avoid the very frequent minor GCs), unfortunately, this means that each individual collection is more expensive.

I would like to be able to specify, per-class, a tenure rate, and set it as very low for the specific classes of objects which I know will never get GCed (and which are very very large) (in his case, it's about

My application is highly latency sensitive.

My current set up is using CMS with a min/max heap size of 48.

Is this possible? I have searched through every possible JVM flag and can't find anything to that effect, and cannot see a way to do it with a custom class loader.

like image 590
user1018513 Avatar asked Apr 02 '14 15:04

user1018513


1 Answers

Considering Hotspot, there is no such flag that would allow you to allocate certain Class instances directly in the OldGen.

If the pool is really reused and "permanent", you should be getting frequent minor gcs only during the pool allocation. You need to run your application for a longer period of time and see if the pool was indeed tenured. After that, you should not be seeing any minor GC caused by the pool usage.

like image 162
Aleš Avatar answered Sep 30 '22 18:09

Aleš