Pause/Resume read from Socket - branch 4.x#261
Conversation
|
I think this should use instead NetSocket pause / resume instead |
|
It doesn’t have the same effect, in fact, it has no effect at all. I tried to simply replace messageHandler with handler here: but doing so resulted in no messages being delivered at all. If you think this is the correct direction, let me know and I’ll spend some more time understanding where the missing piece is. |
|
right, this is because messages are not accounted by back pressure and I think only works in master. can you make a PR for master and use pause/resume so we check that ? I would like to determine what is the long term viable option for this. |
|
on master it works with NetSocket, see PR #262 Let me know how to proceed for this PR on 4.x branch |
|
the tests seem to do very large pause with the timers, is that possible to have a test that takes less time ? |
|
pause reduced, like for 5.0 branch, I had to update testcontainer to pass the CI |
Motivation: The ability to pause reading from the socket to avoid being overwhelmed by QoS 0 messages during traffic spikes. When reading is paused, incoming data accumulates in the TCP receive buffer. As the buffer fills up, the TCP stack advertises a reduced window size (eventually a zero window) to the broker, applying backpressure at the TCP level. At that point, outgoing data may accumulate in the broker’s socket send buffer until its limits are reached. Depending on the broker’s implementation and configuration, QoS 0 messages that cannot be written may be buffered or dropped. Changes: Implement new pause/resume methods that change the setAutoRead(bool) connection's option.
|
thanks @dometec can you provide a PR for master that also upgrades the test ? |
PR for the old #6 :)
I want to pause reading from the socket to avoid being overwhelmed by QoS 0 messages.
When reading is paused, incoming data accumulates in the TCP receive buffer. As the buffer fills up, the TCP stack advertises a reduced window size (eventually a zero window) to the broker, applying backpressure at the TCP level.
At that point, outgoing data may accumulate in the broker’s socket send buffer until its limits are reached. Depending on the broker implementation and configuration, QoS 0 messages that cannot be written may be buffered or dropped.