CMS or Paraller GC in Sun JVM on application with heap 2-4 Gb could stop it on time about 1 minute for collect dead objects! If your application is server application. If it should guarantee processing time at most 10 seconds with these GCs you can't do this. For example, if you work in bank sphere and you should process trades very very quickly in 1 second, you can't make this, because in each time GC could stop your threads and start collect =(
General information
All GC in JVM are generation GC http://en.wikipedia.org/wiki/Garbage_collection_(computer_science). Commonly they have three generation:
- young - new objects
- old - objects are after a couple GC cycles
- permanent - classes and JVM data
GC has three variants of collect:
- minor - only young generation
- major - only old and permanent generation
- full - minor and major collection
Collect of young generation it's very fast process so in a majority cases when we talk about low-latency we mean decrease pause on collect old generation.
Solutions
Let's start from free decisions...
GC called G1 for Oracle JVM
This is free decision, which you could use on any Oracle (Sun) JVM starts from version 1.6-16, so it's very cheap decision. Just turn on this GC JVM option: -XX:+UseG1G
It devides heap on same regions by default 1 Mb. Simultaneously with application GC watchs for live objects in each region. This statistics allow its make pauses very small and predictable.
You could specify for G1 pause max interval over JVM parameter: -XX:GCPauseIntervalMillis=50. G1 no gurantees that pauses always be less then max interval but G1 tend to make this.
http://www.austinjug.org/presentations/JDK6PerfUpdate_Dec2009.pdf
http://developers.sun.ru/techdays2010/reports/ClientTechnologiesTrack/TD_STP_G1_Mesnik.pdf
http://developers.sun.ru/techdays2010/reports/ClientTechnologiesTrack/TD_STP_G1_Mesnik.pdf
LMAX
It's not really decision for decrease GC pause and it expensive because it's not ready decision, it's just architecture. So if you wish use it you should refactor your application.
General points: that business logic executes sequentially (one trade) on in-memory objects without expensive IO operations. The works like marshaling, unmarshalling execute in separated threads input and output discruptor. This arhitecture helps GC because it devides all heap objects on very temporary and very permanent very good. And as we know young collect is very fast.
Azule JVM
Not free from fee decision. Azule provide GC which collect old and young gen without stop the world pauses. For implement this Azule use own JVM. This JVM use memory paging subsystem for control object life-cycle. It's risky decision when you have working application because you should migrate on new JVM.
JRTS
Java Real-time system it's not free decision. JRTS it's just standard so you could find many implementations: reference from Sun, Oracle and etc. In any cases you should migrate on new JVM, but I don't think that it's big problem in this case all of this JVM very stability and well tested. For decrease GC pauses JRTS define three types of real time threads. Non-heap, critical and non-critical. The first threads executed without any GC pauses, it's reach over define special memory part for this threads.
Metronome GC from IBM
Not free from fee decision which allow only on IBM JVMs. Metronome allow you specify max GC pause and reach it over using three features: very chip read-barriers, technique of divide large arrays on parts and quantums. Last feature divide GC work on very small pieces about 500us. GC alternate its work with application work, so for example from each 10 millisecond GC use only 30% time.
BigMemory from Terracota
Not free decision. Use Java NIO http://en.wikipedia.org/wiki/New_I/O for hide big amount of data from GC.

Комментариев нет:
Отправить комментарий