From 553ab87564b5424431cad4a949d8fa84c6601837 Mon Sep 17 00:00:00 2001 From: Pavel Ptashyts <49400901+pavel-ptashyts@users.noreply.github.com> Date: Mon, 20 Jul 2026 10:48:27 +0200 Subject: [PATCH 1/3] Batch HTTP/2 upload body flushes Avoid flushing every intermediate HTTP/2 DATA chunk produced by Http2BodyWriter. The pump now flushes when it yields for source suspension, when backpressure makes the stream unwritable, or when it writes the terminal DATA frame. This preserves bounded in-flight write behavior while reducing per-chunk flush overhead for multi-chunk uploads. Add a focused unit test for the single terminal flush path while the stream remains writable. Codex on behalf of Pavel Ptashyts Co-Authored-By: Codex --- .../netty/request/body/Http2BodyWriter.java | 14 ++- .../request/body/Http2BodyWriterTest.java | 97 +++++++++++++++++++ 2 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 client/src/test/java/org/asynchttpclient/netty/request/body/Http2BodyWriterTest.java diff --git a/client/src/main/java/org/asynchttpclient/netty/request/body/Http2BodyWriter.java b/client/src/main/java/org/asynchttpclient/netty/request/body/Http2BodyWriter.java index 77ebdb8cf..5e6a03a36 100644 --- a/client/src/main/java/org/asynchttpclient/netty/request/body/Http2BodyWriter.java +++ b/client/src/main/java/org/asynchttpclient/netty/request/body/Http2BodyWriter.java @@ -38,8 +38,9 @@ *

* This writer is a one-chunk-at-a-time pump driven entirely on the stream channel's event loop: *