-
Notifications
You must be signed in to change notification settings - Fork 61
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
Use directBuffer with 8m initial capacity #1105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be equally dangerous (especially if the write happen in the blocking thread pool executor), see quarkusio/quarkus#32546.
I strongly suggest to try reuse quarkusio/quarkus#32858 (AppendBuffer and maybe the stream itself?) and expose both min and buffer size, to both save number of packets creations AND to avoid duplicated code
wdyt?
Definitely +1 to using the same approach as @franz1981 introduced in RESTEasy Reactive as if has worked out really well for us |
Just fyi (to be verified): https://github.com/netty/netty/blob/4.1/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java#L122 32K is the max cacheable size for pooled allocations, which means that 8 mb will not be pooled AND could create other problems eg https://sourceware.org/bugzilla/show_bug.cgi?id=11261 Tldr performing malloc/free (used under the hood by Netty for unspooled big allocations) can cause RSS increases due to thread-local arenas of glibc malloc. |
@ppalaga can you share here the stack trace which lead to VertxServletOutputStream's method call? Maybe there's some interesting low hanging fruit which would avoid other intermediate big allocation(s) as well (eg an intermediate encoded byte[] out of a |
Yep, here it is:
|
Thanks @ppalaga so...quick analysis: Due to this, I strongly recommend to try reuse the existing jackson approach mentioned earlier, because it's both fixing the issue and preventing further performance issues (till the next one :P). |
Thanks for the hint, but the idea with 8m was not meant for merging. It was rather a quick fix to figure out whether the approach brings any improvement at all.
You mean the AppendBuffer? I created a new PR #1106 Let's continue the discussion there. |
#1066