Skip to content

8381834: Improve TLAB sizing heuristics#30622

Open
albertnetymk wants to merge 1 commit intoopenjdk:masterfrom
albertnetymk:tlab-heuristic
Open

8381834: Improve TLAB sizing heuristics#30622
albertnetymk wants to merge 1 commit intoopenjdk:masterfrom
albertnetymk:tlab-heuristic

Conversation

@albertnetymk
Copy link
Copy Markdown
Member

@albertnetymk albertnetymk commented Apr 8, 2026

The patch introduces global allocation fraction tracking (AdaptiveWeightedAverage) alongside per-thread allocation fraction. It uses observed global requested-size fraction to estimate initial per-thread TLAB size. Additionally, there's a temporary size boost (up to 16X) when refill pressure is high so threads with real allocation demand do not regress.

I ran MTLinkedListGC.java before and after the change. The largest effect is in debug builds: both Parallel and G1 end up with a much smaller heap, and many fewer GCs. Release builds also improve, although the gap is smaller there.

[linux-x64-debug]
ParallelGC
baseline: [168.731s][info][gc] GC(636) Pause Young (Allocation Failure) 877M->150M(880M) 86.101ms
patched : [3.917s][info][gc] GC(22) Pause Young (Allocation Failure) 23M->9M(27M) 3.579ms

G1GC
baseline: [40.078s][info][gc] GC(80) Pause Young (Normal) (G1 Evacuation Pause) 1471M->9M(7960M) 199.514ms
patched : [3.298s][info][gc] GC(10) Pause Young (Normal) (G1 Evacuation Pause) 126M->23M(180M) 16.209ms

Performance-neutral for DaCapo, SPECjbb2015, and SPECjvm2008. Also checked in gc+tlab=debug logs that the number of tlab refills are mostly on par.

Test: tier1-5


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8381834: Improve TLAB sizing heuristics (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30622/head:pull/30622
$ git checkout pull/30622

Update a local copy of the PR:
$ git checkout pull/30622
$ git pull https://git.openjdk.org/jdk.git pull/30622/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30622

View PR using the GUI difftool:
$ git pr show -t 30622

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30622.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 8, 2026

👋 Welcome back ayang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 8, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8381834 8381834: Improve TLAB sizing heuristics Apr 8, 2026
@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Apr 8, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 8, 2026

@albertnetymk The following label will be automatically applied to this pull request:

  • hotspot-gc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 8, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 8, 2026

Webrevs

Copy link
Copy Markdown
Member

@walulyai walulyai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the log snippet showing the improvement, is this with ~1000 threads as described in the CR?

@albertnetymk
Copy link
Copy Markdown
Member Author

For the log snippet showing the improvement, is this with ~1000 threads as described in the CR?

Yes, from running MTLinkedListGC.java with -Xlog:gc. That test creates ~1000 threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-gc hotspot-gc-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants