GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — AdaptivePoolingAllocator EventLoop Magazine's affinity by franz1981 · Pull Request #14047 · netty/netty

Conversation

@franz1981

@franz1981 franz1981 commented May 10, 2024

Copy link
Copy Markdown
Contributor

Motivation:

AdaptivePoolingAllocator uses some shared Magazines hoping thread's id distribution to improve contended behaviour, but event loops threads can just uses their own Magazine(s) and save 2 atomic operations (write lock/unlock) in the hot path, further improving performance.

Modification:

Implements dedicated event loop Magazines

Result:

Better allocation performance for event loop threads

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jchrys reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@franz1981 franz1981 added the feature label May 10, 2024
@franz1981
franz1981 requested review from chrisvest and normanmaurer May 10, 2024 20:58
@franz1981

franz1981 commented May 10, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

This is trying hard to make close right(ish) - that's why it doesn't allow to just use FastThreadLocalThreads, but I can relax this a bit, accepting FastThreadLocalThreads which cleanup their FastThreadLocal, too: but clearly it means that closing the allocator won't do anything to the Magazines held in threadLocalMagazine.

Additionally, in Netty 5 i see no usedMemory counters: which will likely make this allocator to still perform better than the existing one in Netty 4.1.

Another pain point of the Netty 5 version is that allowing close means that users can really have fun creating many allocators, and per instance FastThreadLocal are a problem, because there's a giant array to back all the entries which will keep on being atomically increased as new instances are created....

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@franz1981
AdaptivePoolingAllocator EventLoop Magazine's affinity
344bf9b
Motivation:

AdaptivePoolingAllocator uses some shared Magazines hoping thread's id
distribution to improve contended behaviour, but event loops threads can
just uses their own Magazine(s) and save 2 atomic operations (write
lock/unlock) in the hot path, further improving performance.

Modification:

Implements dedicated event loop Magazines

Result:

Better allocation performance for event loop threads
@franz1981
franz1981 force-pushed the main_event_executor_magazines branch from bca0a9d to 344bf9b Compare May 10, 2024 21:09
chrisvest
chrisvest requested changes May 10, 2024
View reviewed changes
Comment thread buffer/src/main/java/io/netty5/buffer/adapt/AdaptivePoolingAllocator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread buffer/src/main/java/io/netty5/buffer/adapt/AdaptivePoolingAllocator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread buffer/src/main/java/io/netty5/buffer/adapt/AdaptivePoolingAllocator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@franz1981
Fix by chris comment
82418f4
@franz1981

franz1981 commented May 14, 2024

Copy link
Copy Markdown
Contributor Author

I think I forgot to close the magazine on ThreadLocal::onRemove

normanmaurer reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@franz1981
Add Magazine::close on thread local's remove
304c5ce
@franz1981

franz1981 commented May 14, 2024

Copy link
Copy Markdown
Contributor Author

Done @normanmaurer let's see what the CI think

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisvest
chrisvest approved these changes May 14, 2024
View reviewed changes
@chrisvest
chrisvest merged commit c77c02e into netty:main May 14, 2024
@franz1981
franz1981 deleted the main_event_executor_magazines branch May 16, 2024 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest approved these changes
@normanmaurer normanmaurer Awaiting requested review from normanmaurer

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

feature

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@franz1981 @chrisvest
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.