1. TLAB(Thread Local Allocation Buffers)란 무엇인가?

  • Heap 메모리에 새로운 객체가 생성될 때, 만약 TLAB이 활성화되어 있다면 객체는 우선 TLAB에 위치하게 된다.
  • TLAB은 Eden 영역에만 존재한다. 따라서 TLAB을 사용하면 에덴 영역을 좀 더 많이 사용하게 되지만 객체 생성시 성능 효과를 볼 수 있다.
  • 각 스레드는 빠른 메모리 할당을 위해 자신만의 TLAB을 가지고 있다.
  • TLAB은 각 스레드에 미리 할당되어 있다.
  • 따라서 TLAB의 총 크기는 스레드 수에 비례한다.
  • TLAB을 사용하려면 -XX:+UseTLAB 옵션을 사용한다.
  • TLAB의 크기를 조절하려면 -XX:+UseTLAB 옵션을 사용한다. 디폴트는 0인데 이때는 시스템이 알아서 조절하게 된다.

 

2. PLAB(Promotion Local Allocation Buffers)란 무엇인가?

  • GC에서 Generation을 청소하는 동안 사용된다.
  • 각 스레드에 존재한다.

 

3. 옵션

3-1. -XX:+PrintTLAB

TLAB: gc thread: 0x00007f12d444d000 [id: 9220] desired_size: 5253KB slow allocs: 0  refill waste: 84048B alloc: 1.00000   262656KB refills: 1 waste 96.1% gc: 5167296B slow: 0B fast: 0B
TLAB: gc thread: 0x00007f12d444c800 [id: 9218] desired_size: 5253KB slow allocs: 0  refill waste: 84048B alloc: 1.00000   262656KB refills: 1 waste 96.1% gc: 5167256B slow: 0B fast: 0B
TLAB: gc thread: 0x00007f12d444a000 [id: 9215] desired_size: 5253KB slow allocs: 0  refill waste: 84048B alloc: 1.00000   262656KB refills: 1 waste 96.0% gc: 5166080B slow: 0B fast: 0B
TLAB: gc thread: 0x00007f12d4448000 [id: 9212] desired_size: 5253KB slow allocs: 0  refill waste: 84048B alloc: 1.00000   262656KB refills: 1 waste 96.7% gc: 5200080B slow: 0B fast: 0B
TLAB: gc thread: 0x00007f12d4447000 [id: 9210] desired_size: 5253KB slow allocs: 0  refill waste: 84048B alloc: 1.00000   262656KB refills: 1 waste 96.3% gc: 5179496B slow: 0B fast: 0B
(생략)
TLAB totals: thrds: 33  refills: 39 max: 6 slow allocs: 0 max 0 waste: 78.8% gc: 165378464B max: 5378928B slow: 736B max: 704B fast: 0B max: 0B
TLAB totals: thrds: 33  refills: 39 max: 6 slow allocs: 0 max 0 waste: 78.8% gc: 165245312B max: 5378928B slow: 368B max: 328B fast: 0B max: 0B
TLAB totals: thrds: 37  refills: 84 max: 9 slow allocs: 4 max 1 waste: 21.3% gc: 41685120B max: 5379120B slow: 202264B max: 45128B fast: 0B max: 0B
TLAB totals: thrds: 35  refills: 129 max: 12 slow allocs: 8 max 2 waste: 16.3% gc: 33513720B max: 5344256B slow: 421456B max: 88832B fast: 0B max: 0B
TLAB totals: thrds: 44  refills: 173 max: 16 slow allocs: 35 max 8 waste: 24.0% gc: 52984776B max: 5333392B slow: 508152B max: 62944B fast: 0B max: 0B
TLAB totals: thrds: 41  refills: 240 max: 22 slow allocs: 60 max 5 waste: 13.4% gc: 27595256B max: 2688952B slow: 761752B max: 112192B fast: 0B max: 0B
TLAB totals: thrds: 34  refills: 322 max: 31 slow allocs: 65 max 7 waste:  9.6% gc: 20742400B max: 1740696B slow: 822424B max: 130184B fast: 0B max: 0B
TLAB totals: thrds: 41  refills: 409 max: 32 slow allocs: 155 max 11 waste:  7.0% gc: 13045448B max: 1591360B slow: 619808B max: 90904B fast: 0B max: 0B
TLAB totals: thrds: 41  refills: 539 max: 40 slow allocs: 390 max 64 waste:  5.7% gc: 11271520B max: 1591840B slow: 1026104B max: 271928B fast: 0B max: 0B
TLAB totals: thrds: 45  refills: 656 max: 44 slow allocs: 523 max 75 waste:  4.2% gc: 8258552B max: 973136B slow: 790816B max: 128424B fast: 0B max: 0B
TLAB totals: thrds: 37  refills: 721 max: 48 slow allocs: 690 max 70 waste:  2.2% gc: 3771880B max: 417680B slow: 905232B max: 222544B fast: 0B max: 0B
TLAB totals: thrds: 45  refills: 812 max: 49 slow allocs: 682 max 79 waste:  3.6% gc: 7134032B max: 973976B slow: 717656B max: 134944B fast: 0B max: 0B
TLAB totals: thrds: 40  refills: 692 max: 39 slow allocs: 733 max 67 waste:  1.6% gc: 1954992B max: 315616B slow: 655208B max: 175088B fast: 0B max: 0B
TLAB totals: thrds: 42