Remove unnecessary write_avail causing extra block allocations for h2 #5894
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.
Using @bryancall's proxy.config.res_track_memory feature to figure out buffer allocations, it showed that the buffer set up by HttpSM::setup_server_transfer had over 2000 allocations for a H2 transfer of 10MB but only 600 allocations for the same transfer over H1.
This code change, reduced the number of allocations to around 1000 for H2. Still higher than H1, but much better.
The write_avail will never return 0 and always allocate a new block if the current writer block is full. So the if return should never trigger. In the H2 logic, we are copying IOBlocks from the origin side MIOBuffer, so the empty block will never be used. Could explain why we started seeing unusually long buffer block chains.