Hi Akka Team,
I think backpressure for (single) WebSockets might be broken. A test project shows strange behavior
see attached screenshots and reproducer repository. The strange thing is that if this is correct it has been broken during the transition from Akka Streams 1.0 to Akka Streams 2.0 and is broken since including the latest release Akka 2.4.10. So potentially I'm missing some important settings?
echo server with red == data in, green == data out
observed backpressure with Akka 1.0
no backpressure with Akka 2.x
code
Assumption: if the server is not reading from a WebSocket stream after the HTTP upgrade this should result in TCP backpressure thus blocking the sender. If the server reads slowly the sender will be throttled (via TCP).
Test Setup:
A Netty based WebSocket client sending data as fast as possible. A Akka Http based WebSocket server receiving data and throttling the data stream (with sleep because the throttle stage didn't exist at the time of writing).
1000 bytes per WS object
10 milliseconds delay per WS object
20 MB test data => ~20.000 WS objects
no further configuration
(running with 200MB and 2 milliseconds yields similar results)
reproducing without sockets
code see branch broken serverLayer
A small test without Netty / real Sockets / real IO yields similar results, the source seems to
complete very fast without being backpressured by the slow intermediate consumer. Interestingly
a test with a large streamed HTTP Post request does show backpressure.
Hope that helps if you have further questions don't hesitate
best Michael
Thanks, @MichaelZinsmaier. The reproducer helps a lot!
We have confirmed that this is a regression introduced some months ago and are working on a fix.
glad to hear! I have some local tests to produce the graphs ...
Once you have a solution I can try to reproduce / confirm that it is solved
thanks, it seems to work (-:
Excellent, thanks for reporting and confirming 馃憤
And so the order of the Universe have been restored.
Most helpful comment
And so the order of the Universe have been restored.