Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce contention in all ByteBufferPool implementations #6379

Closed
lorban opened this issue Jun 9, 2021 · 0 comments · Fixed by #6380 or #6387
Closed

Reduce contention in all ByteBufferPool implementations #6379

lorban opened this issue Jun 9, 2021 · 0 comments · Fixed by #6380 or #6387

Comments

@lorban
Copy link
Contributor

lorban commented Jun 9, 2021

Target Jetty version(s)
9.4.x, 10.0.x, 11.0.x

Enhancement Description

All ByteBufferPool implementations use ByteBufferPool.Buckets to track ByteBuffers. The current implementation of Bucket stores buffers in a ConcurrentLinkedDeque, and calls poll() to acquire a pooled buffer and offerFirst() to release a buffer.

This means that all the contention is done at the head of the queue for no particular reason. An easy way to reduce that contention would be to release buffers at the tail of the queue by calling offer() instead of offerFirst(), this way all the acquisition contention would happen at the head while all the releasing contention would happen at the tail, basically halving the contention.

Replacing the ConcurrentLinkedDeque with a ConcurrentLinkedQueue could also improve performance an extra bit too.

@lorban lorban self-assigned this Jun 9, 2021
@lorban lorban added this to To do in Jetty 9.4.43 FROZEN via automation Jun 9, 2021
@lorban lorban added this to To do in Jetty 10.0.5/11.0.5 FROZEN via automation Jun 9, 2021
lorban added a commit that referenced this issue Jun 9, 2021
…urrent queue implementation

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban linked a pull request Jun 9, 2021 that will close this issue
lorban added a commit that referenced this issue Jun 10, 2021
…urrent queue implementation

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
lorban added a commit that referenced this issue Jun 10, 2021
…urrent queue implementation

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban changed the title Reduce contention in all ByteBufferPool implementations 9.4.x: Reduce contention in all ByteBufferPool implementations Jun 10, 2021
@lorban lorban changed the title 9.4.x: Reduce contention in all ByteBufferPool implementations Reduce contention in all ByteBufferPool implementations Jun 10, 2021
@sbordet sbordet removed this from To do in Jetty 10.0.5/11.0.5 FROZEN Jun 10, 2021
@sbordet sbordet added this to To do in Jetty 10.0.6/11.0.6 FROZEN via automation Jun 10, 2021
lorban added a commit that referenced this issue Jun 10, 2021
…urrent queue implementation

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Jetty 9.4.43 FROZEN automation moved this from To do to Done Jun 10, 2021
Jetty 10.0.6/11.0.6 FROZEN automation moved this from To do to Done Jun 10, 2021
lorban added a commit that referenced this issue Jun 10, 2021
…urrent queue implementation

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
lorban added a commit that referenced this issue Jan 9, 2024
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
lorban added a commit that referenced this issue Jan 9, 2024
…ler concurrent queue implementation"

This reverts commit 33c1b14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
1 participant