Java Reference
In-Depth Information
There are parameters to control this (which are discussed later in this section), but the key is
that the size of the TLAB is crucial. By default, the size of a TLAB is based on three things:
the number of threads in the application, the size of eden, and the allocation rate of threads.
Hence two types of applications may benefit from tuning the TLAB parameters: applications
that allocate a lot of large objects, and applications that have a relatively large number of
threads compared to the size of eden. By default, TLABs are enabled; they can be disabled
by specifying -XX:-UseTLAB , although they give such a performance boost that disabling
them is always a bad idea.
Since the calculation of the TLAB size is based in part on the allocation rate of the threads, it
is impossible to definitively predict the best TLAB size for an application. What can be done
instead is to monitor the TLAB allocation to see if any allocations occur outside of the
TLABs. If a significant number of allocations occur outside of TLABs, then there are two
choices: reduce the size of the object being allocated, or adjust the TLAB sizing parameters.
Monitoring the TLAB allocation is another case where Java Flight Recorder is much more
powerful than other tools. Figure 6-9 shows a sample of the TLAB allocation screen from a
JFR recording.
Search WWH ::

Custom Search