Allocations in new TLAB vs allocations outside TLAB
Asked Answered
U

1

50

The Java Mission Control tool in the JDK provides statistics about object allocation in new TLAB and allocations outside TLAB. (It's under Memory/Allocations). What is the significance of these statistics, what is good for the performance of an application? Should I be worried if some objects are allocated outside TLAB and if yes, what can I do about it?

Unobtrusive answered 14/10, 2014 at 1:15 Comment(1)
shipilev.net/jvm-anatomy-park/4-tlab-allocationWaterfall
P
85

A TLAB is a Thread Local Allocation Buffer. The normal way objects are allocated in HotSpot is within a TLAB. TLAB allocations can be done without synchronization with other threads, since the Allocation Buffer is Thread Local, synchronization is only needed when a new TLAB is fetched.

So, the ideal scenario is that as much as possible of the allocations are done in TLABs.

Some objects will be allocated outside TLABs, for example large objects. This is nothing to worry about as long as the percentage of allocations outside TLABs vs allocations in new TLABs is low.

The TLABs are dynamically resized during the execution for each thread individually. So, if a thread allocates very much, the new TLABs that it gets from the heap will increase in size. If you want you can try to set the flag -XX:MinTLABSize to set minimum TLAB size, for example -XX:MinTLABSize=4k

Answer provided by my colleague David Lindholm :)

Purport answered 14/10, 2014 at 10:33 Comment(1)
great info on TLABS! ThanksConsciencestricken

© 2022 - 2024 — McMap. All rights reserved.