Profile Image
vishnupriya

What is JVM startup parameter: -XX:TLABSize?

What is JVM startup parameter: -XX:TLABSize? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-tlabsize

  • x-tlabsize

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

You can set minimum allowed Thread Local Allocation Buffers (TLAB) size (in bytes) with:

 

-XX:TLABSize=value , where value is the desired size in bytes.

 

Since:

 

Starting from JDK 6.

 

Examples:

 

This will instruct JVM to use 512 KB of the allowed TLAB size:

 

-XX: TLABSize=512k

 

Description

 

In Java, new objects are allocated in Eden. It’s a memory space shared between threads. If you take into account that multiple threads can allocate new objects at the same time, it becomes obvious that some sort of synchronization mechanism is needed. How could it be solved? Allocation queue? Some kind of mutex? Even though these are decent solutions, there is a better one. Here is where TLAB comes into play. TLAB stands for Thread Local Allocation Buffer and it is a region inside Eden, which is exclusively assigned to a thread. In other words, only a single thread can allocate new objects in this area. Each thread has own TLAB. Thanks to that, as long as objects are allocated in TLABs, there is no need for any type of synchronization. Allocation inside TLAB is a simple pointer bump (that’s why it’s sometimes called pointer bump allocation) — so, the next free memory address is used.

 

This flag sets the initial size (in bytes) of a thread-local allocation buffer (TLAB). Append the letter k or K to indicate kilobytes, m or M to indicate megabytes, or g or G to indicate gigabytes. If this option is set to 0, then the JVM selects the initial size automatically. Also, the TLAB size can’t be:

 

  • More than a maximum value.
  • Less than a minimum value determined by -XX:MinTLABSize flag.

Default Value:

 

Default is 0.

 

Errors:

 

The size should not be more than a maximum value or less the minimum set by MinTLABSize.

 

Arguments related:

 

MinTLABSize, ResizeTLAB

 

Related Posts:

 

 

 

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-tlabsize

  • x-tlabsize

  • JVM startup parameter