ihudedi commented on issue #884:
URL: https://github.com/apache/mina-sshd/issues/884#issuecomment-4007642700
Hi @tomaswolf
Thank you! The detailed logging reveals the issue. Here's what's happening:
Initial window: 16,777,216 bytes (16MB)
Packet size: 65,535 bytes
Pattern observed:
1. CONSUME: 65,564 bytes → window drops to 16,711,281
2. RELEASE: 65,564 bytes → size=16,711,281, size+released=16,777,216
- Condition check: size < maxFree/2? NO (16,711,281 > 8,388,608)
- Condition check: maxFree - size > 3*packetSize? NO (65,935 < 196,605)
- willSendAdjust: false
3. CONSUME: 131KB more → window drops to 16,580,209
4. RELEASE: 65,564 bytes → size=16,580,209
- Condition check: maxFree - size > 3*packetSize? YES (197,007 > 196,605)
- willSendAdjust: true
The condition `maxFree - size > 3 * packetSize` triggers as soon as **more
than ~197KB has been consumed**. Since:
- Data arrives faster than it's released (buffered writing)
- Each release is ~65KB
- Window adjust is sent every time ~197KB has been consumed
This results in **~66-200 window adjust messages per 5 seconds**, each
taking **121-493us**.
In a high-throughput proxy scenario where data is buffered/forwarded, is
this the intended behavior? The window is still **>99% available** (16.58MB out
of 16.77MB), yet we're sending frequent adjust messages.
Would it make sense to make the threshold configurable, or to be less
aggressive when the window is still mostly available?
this the example of the log:
2026-03-05 20:52:36,136 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16776967, consumed=33, window after=16776934
2026-03-05 20:52:36,167 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-1] (LocalWindow:95) - CONSUME:
window before=16776934, consumed=32, window after=16776902
2026-03-05 20:52:36,168 WARN [sshd-FactoryExecutorService-thread-1]
(LocalWindow:151) - RELEASE: len=33, reachedLine114=false, size=0,
size+released=-1, maxFree=16777216, packetSize=65535, willSendAdjust=false
2026-03-05 20:52:36,196 WARN [sshd-FactoryExecutorService-thread-1]
(LocalWindow:151) - RELEASE: len=32, reachedLine114=false, size=0,
size+released=-1, maxFree=16777216, packetSize=65535, willSendAdjust=false
2026-03-05 20:52:39,210 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-1] (LocalWindow:95) - CONSUME:
window before=16776902, consumed=57, window after=16776845
2026-03-05 20:52:39,281 WARN [sshd-FactoryExecutorService-thread-1]
(LocalWindow:151) - RELEASE: len=57, reachedLine114=false, size=0,
size+released=-1, maxFree=16777216, packetSize=65535, willSendAdjust=false
2026-03-05 20:52:39,282 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-3] (LocalWindow:95) - CONSUME:
window before=16776845, consumed=16384, window after=16760461
2026-03-05 20:52:39,284 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-3] (LocalWindow:95) - CONSUME:
window before=16760461, consumed=16384, window after=16744077
2026-03-05 20:52:39,285 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-3] (LocalWindow:95) - CONSUME:
window before=16744077, consumed=16384, window after=16727693
2026-03-05 20:52:39,286 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-3] (LocalWindow:95) - CONSUME:
window before=16727693, consumed=16384, window after=16711309
2026-03-05 20:52:39,291 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-3] (LocalWindow:95) - CONSUME:
window before=16711309, consumed=28, window after=16711281
2026-03-05 20:52:39,314 WARN [sshd-FactoryExecutorService-thread-1]
(LocalWindow:151) - RELEASE: len=65564, reachedLine114=true, size=16711281,
size+released=16777216, maxFree=16777216, packetSize=65535, willSendAdjust=false
2026-03-05 20:52:39,315 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16711281, consumed=16384, window after=16694897
2026-03-05 20:52:39,316 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16694897, consumed=16384, window after=16678513
2026-03-05 20:52:39,317 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16678513, consumed=16384, window after=16662129
2026-03-05 20:52:39,318 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16662129, consumed=16384, window after=16645745
2026-03-05 20:52:39,318 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16645745, consumed=16384, window after=16629361
2026-03-05 20:52:39,319 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16629361, consumed=16384, window after=16612977
2026-03-05 20:52:39,320 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16612977, consumed=16384, window after=16596593
2026-03-05 20:52:39,329 WARN
[sshd-SshServer[61bfd08f](port=1224)-nio2-thread-2] (LocalWindow:95) - CONSUME:
window before=16596593, consumed=16384, window after=16580209
2026-03-05 20:52:39,333 WARN [sshd-FactoryExecutorService-thread-1]
(LocalWindow:151) - RELEASE: len=65564, reachedLine114=true, size=16580209,
size+released=16580209, maxFree=16777216, packetSize=65535, willSendAdjust=true
Thanks,
Itay
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]