GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — JdkZlibDecoder: accumulate decompressed output before firing channelRead by franz1981 · Pull Request #16510 · netty/netty Conversation
|
|
@normanmaurer I'm still checking how to expose it for "expert" users: any suggestion @yawkat ? @vietj ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm running some benchmark to make sure is not regressing in any form |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The reproducer from @wbabyte is not passing as good as before the zip bomb changes, because the composite buffer is very bad with single byte access 😢 @chrisvest Which means:
wdyt @normanmaurer ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@franz1981 there's #16076 … I think we need a new approach to composite buffer use cases, which sits somewhere between the large flat buffers and fragmented composite buffers |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
yeah so, moving to copying into a single flat buffer proved to be enough to fix the issue on the reproducer where Fix v1 is what we got in this pr and the heapBuffer consolidation uses a single heap buffer (to match the input ones). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sounds like a cumulation strategy, basically. I think this could also be done as a separate read consolidation handler?
What do you mean by this? I don't see how adaptive is different in this regard from the other allocators. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes, it effectively is!
It could, but the batching needs to be aware of the decode boundaries — we must flush after each writeInbound + finish call to avoid delaying content delivery.
You're right to challenge that — I was wrong. The issue I observed was about CompositeByteBuf random-access performance (findComponent per getByte) and JDK 21+ direct buffer FFM overhead (MemorySessionImpl.checkValidStateRaw), neither of which is specific to the adaptive allocator. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
6b9a45f to
6a2e2ee
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
6b96bc1 to
dc3b872
Compare
|
Updated figures @wbabyte can you check if it works for you? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
dc3b872 to
e978307
Compare
|
@franz1981 thank you for this. I can try it out, but do you have a build I can use? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@wbabyte I think you should build (clean install) it from this branch PR and set in your reproducer a snapshot release 🙏 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e978307 to
8e79ccd
Compare
There was an error while loading. Please reload this page.
8e79ccd to
2326755
Compare
|
I would backport this to 4.1 as well, wdyt? @normanmaurer @yawkat |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We already had people complain with the original change which did the opposite thing (more fragmentation), so I'm not sure backporting is a good idea. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
But this would leave 4.1 users with the performance degradation...? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@yawkat I think backporting makes sense in this case /cc @chrisvest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
PTAL @normanmaurer I've addressed #16510 (comment) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@chrisvest do you agree that we should also port this to 4.1 ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@normanmaurer I'm not too strongly opinionated on it, but I think it makes sense to backport if its not too much trouble. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…ead (#16510) Motivation: A recent change (9d804c5) changed JdkZlibDecoder to fire ctx.fireChannelRead() on every inflate iteration (~8KB output) when maxAllocation is 0. For a typical ~150KB HTTP response this produces ~19 small buffer allocations and ~19 pipeline dispatches through the internal EmbeddedChannel used by HttpContentDecoder, causing a 30-35% throughput regression even in aggregated mode (where chunk count is irrelevant downstream). Modifications: Accumulate decompressed output up to 64KB (DEFAULT_MAX_FORWARD_BYTES) before firing ctx.fireChannelRead(). The buffer grows naturally via prepareDecompressBuffer() until the threshold, then fires and starts a new buffer. Any remaining data fires in the finally block as before. Memory per in-flight buffer is bounded to 64KB regardless of the compressed input size. Result: Throughput is restored to pre-regression levels. Chunks per response drop from ~163 to ~6 for a 150KB payload. (cherry picked from commit a7fbb6f)
|
Auto-port PR for 4.1: #16532 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ead (#16510) Motivation: A recent change (9d804c5) changed JdkZlibDecoder to fire ctx.fireChannelRead() on every inflate iteration (~8KB output) when maxAllocation is 0. For a typical ~150KB HTTP response this produces ~19 small buffer allocations and ~19 pipeline dispatches through the internal EmbeddedChannel used by HttpContentDecoder, causing a 30-35% throughput regression even in aggregated mode (where chunk count is irrelevant downstream). Modifications: Accumulate decompressed output up to 64KB (DEFAULT_MAX_FORWARD_BYTES) before firing ctx.fireChannelRead(). The buffer grows naturally via prepareDecompressBuffer() until the threshold, then fires and starts a new buffer. Any remaining data fires in the finally block as before. Memory per in-flight buffer is bounded to 64KB regardless of the compressed input size. Result: Throughput is restored to pre-regression levels. Chunks per response drop from ~163 to ~6 for a 150KB payload. (cherry picked from commit a7fbb6f)
|
Auto-port PR for 5.0: #16533 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…firing channelRead (#16532) Auto-port of #16510 to 4.1 Cherry-picked commit: a7fbb6f --- Motivation: A recent change (9d804c5) changed JdkZlibDecoder to fire ctx.fireChannelRead() on every inflate iteration (~8KB output) when maxAllocation is 0. For a typical ~150KB HTTP response this produces ~19 small buffer allocations and ~19 pipeline dispatches through the internal EmbeddedChannel used by HttpContentDecoder, causing a 30-35% throughput regression even in aggregated mode (where chunk count is irrelevant downstream). Modifications: Accumulate decompressed output up to 64KB (DEFAULT_MAX_FORWARD_BYTES) before firing ctx.fireChannelRead(). The buffer grows naturally via prepareDecompressBuffer() until the threshold, then fires and starts a new buffer. Any remaining data fires in the finally block as before. Memory per in-flight buffer is bounded to 64KB regardless of the compressed input size. Result: Throughput is restored to pre-regression levels. Chunks per response drop from ~163 to ~6 for a 150KB payload. Co-authored-by: Francesco Nigro <[email protected]>
…firing channelRead (#16533) Auto-port of #16510 to 5.0 Cherry-picked commit: a7fbb6f --- Motivation: A recent change (9d804c5) changed JdkZlibDecoder to fire ctx.fireChannelRead() on every inflate iteration (~8KB output) when maxAllocation is 0. For a typical ~150KB HTTP response this produces ~19 small buffer allocations and ~19 pipeline dispatches through the internal EmbeddedChannel used by HttpContentDecoder, causing a 30-35% throughput regression even in aggregated mode (where chunk count is irrelevant downstream). Modifications: Accumulate decompressed output up to 64KB (DEFAULT_MAX_FORWARD_BYTES) before firing ctx.fireChannelRead(). The buffer grows naturally via prepareDecompressBuffer() until the threshold, then fires and starts a new buffer. Any remaining data fires in the finally block as before. Memory per in-flight buffer is bounded to 64KB regardless of the compressed input size. Result: Throughput is restored to pre-regression levels. Chunks per response drop from ~163 to ~6 for a 150KB payload. Co-authored-by: Francesco Nigro <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.