servicetalk
servicetalk copied to clipboard
Make HTTP/1.x server-side control flow consistent with the client-side
Motivation:
The HTTP/1.x control flow for NettyHttpServer
uses a single write
operation to write an indefinite stream of request/response iterations as a repeated publisher. This difference requires all our transport utilities (e.g. CloseHandler
, WriteStreamSubscriber
, FlushStrategy
) to have special behavior to accommodate the difference.
Modifications:
- Apply
repeat
operator to the returnedwrite
completable; - Deprecate
SplittingFlushStrategy
, it's not required anymore; - Temporarily introduce
ChangingFlushStrategy
to still support changes of theFlushStrategy
per request with existingFlushStrategy
API; -
RequestResponseCloseHandler
emitsOutboundDataEndEvent
on every "payload end"; - Adjust existing tests to account for the new behavior;
- Enhance some tests to use different executors for client & server, it helps with debugging;
Result:
HTTP/1.x server-side control flow is consistent with the client-side.
Note that it changes the way server-side manages demand for new writes. Instead of having a single WriteDemandEstimator
for the entire connection that remembers the size of previous requests, it now has a new WriteDemandEstimator
per exchange, the same way as the client. If we will observe it as a problem, we can share the WriteDemandEstimator
for the entire connection in a follow up, but we should do it consistently for client & serve sides.