Sunday, July 18, 2010

Preventing Memery Locks on the Multi CPU machine

Problem
   Multithreaded apps create new objects at the same time
   New objects are always created in the EDEN space
   During object creation, memory is locked
   On a multi CPU machine (threads run concurrently) there can be contention

Solution
    Allow each thread to have a private piece of the EDEN
    space
Thread Local Allocation Buffer
    -XX:+UseTLAB
    -XX:TLABSize=
    -XX:+ResizeTLAB
    (On by default on multi CPU machines and newer JDK)
Analyse TLAB usage
    -XX:+PrintTLAB
JDK 1.5 and higher (GC ergonomics)
    Dynamic sizing algorithm, tuned to each thread


INSIDE THE JAVA VIRTUAL MACHINE / Filip Hanik

No comments:

Post a Comment