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

Issue #6974 - improvements & fixes to ByteBufferPool implementations #7017

Merged
merged 19 commits into from
Nov 24, 2021

Conversation

lachlan-roberts
Copy link
Contributor

Issue #6974 - improvements to ByteBufferPool implementations

ByteBufferPool Changes

  • Fixes bugs and raceconditions related to use of ArrayByteBufferPool and MappedByteBufferPool with non zero settings for maxHeapMemory and maxDirectMemory.
  • Make a constructor argument of zero for maxHeapMemory and maxDirectMemory mean that a default is calculated based on the total max memory of the JVM.
  • Make the ArrayByteBufferPool and MappedByteBufferPool extensible to change the bucket scaling.
  • Implement the LogArrayByteBufferPool which doubles the size of each consecutive bucket instead of scaling linearly.
  • Implement Dumpable for the ByteBufferPool implementations.

WebSocket Changes

  • WebSocketUpgradeFilter always waits until it is started before it gets the NativeWebSocketConfiguration so it can be created when the ByteBufferPool is ready.
  • WebSocket now uses the servers ByteBufferPool instead of creating its own MappedByteBufferPool every time.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…g of bucket size.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts lachlan-roberts added this to In progress in Jetty 9.4.45 - FROZEN via automation Oct 20, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

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

I think the changes are good, except for the concurrency model which feels broken and should be reviewed.

Jetty 9.4.45 - FROZEN automation moved this from In progress to Review in progress Oct 20, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lorban
lorban previously approved these changes Oct 21, 2021
Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

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

LGTM

Jetty 9.4.45 - FROZEN automation moved this from Review in progress to Reviewer approved Oct 21, 2021
Jetty 9.4.45 - FROZEN automation moved this from Reviewer approved to Review in progress Oct 21, 2021
@sbordet
Copy link
Contributor

sbordet commented Oct 21, 2021

@gregw @lachlan-roberts overall I feel that these changes are too much for 9.4.x.
If the problem is in WebSocket, I don't think we need such massive changes in the buffer pools.
I'm sure I'm missing something, so let's sync on this.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@gregw
Copy link
Contributor

gregw commented Nov 10, 2021

@sbordet @lachlan-roberts let's hangout tonight(tomorrow morning)

@gregw
Copy link
Contributor

gregw commented Nov 10, 2021

... but note that whilst I don't like changes in 9.4, I also don't like the unlimited memory commitment that we currently allow with the default pool with no easy way to change it.

Latest review with @lachlan-roberts.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Jetty 9.4.45 - FROZEN automation moved this from Review in progress to Reviewer approved Nov 12, 2021
sbordet
sbordet previously approved these changes Nov 12, 2021
Latest review with @lachlan-roberts. Fixed typo.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Jetty 9.4.45 - FROZEN automation moved this from Reviewer approved to Review in progress Nov 12, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Can you provide a bytebufferpool-log modules that provides bytebufferpool and uses an alternative xml that configures the log byte buffers

Jetty 9.4.45 - FROZEN automation moved this from Review in progress to Reviewer approved Nov 23, 2021
@lachlan-roberts lachlan-roberts merged commit f86a719 into jetty-9.4.x Nov 24, 2021
Jetty 9.4.45 - FROZEN automation moved this from Reviewer approved to Done Nov 24, 2021
@lachlan-roberts lachlan-roberts deleted the jetty-9.4.x-6974-WebSocketBufferPool branch November 24, 2021 23:09
lachlan-roberts added a commit that referenced this pull request Nov 24, 2021
…7017)

- WebSocket should user server ByteBufferPool if possible
- fix various bugs ByteBufferPool implementations
- add heuristic for maxHeapMemory and maxDirectMemory
- Add dump for ByteBufferPools
- add LogArrayByteBufferPool that does exponential scaling of bucket size.
- ByteBufferPools should default to use maxMemory heuristic
- Add module jetty-bytebufferpool-logarithmic

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
lachlan-roberts added a commit that referenced this pull request Dec 3, 2021
Issue #6974 - improvements & fixes to ByteBufferPool implementations (#7017)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants