ihudedi commented on issue #884:
URL: https://github.com/apache/mina-sshd/issues/884#issuecomment-4004242065

   Hi @tomaswolf 
   Thank you for the suggestion! I actually already instrumented 
LocalWindow.release() to track call frequency and chunk sizes. Here's what I 
found:
   Instrumentation Results:
   Server side (receiving upload data):
   PERF LocalWindow.release(): called 257 times in last 5s, avg 444us per call, 
len avg 65564
   PERF LocalWindow.release(): called 234 times in last 5s, avg 175us per call, 
len avg 65564
   Average chunk size: 65,564 bytes (good - nearly max packet size!)
   Call frequency: ~257 calls per 5 seconds (~51/sec)
   Time per call: 175-444 microseconds
   Client side (sending to hub):
   PERF LocalWindow.release(): called 770 times in last 5s, avg 4us per call, 
len avg 21
   PERF LocalWindow.release(): called 729 times in last 5s, avg 5us per call, 
len avg 21
   Average chunk size: 21 bytes (small - likely SSH/SFTP protocol responses, 
not data)
   Call frequency: ~770 calls per 5 seconds (~154/sec)
   Time per call: 4-5 microseconds (fast - not a bottleneck)
   Key Finding:
   The chunk sizes are actually reasonable - the server side is releasing 
full-packet-sized chunks (65KB). The issue is that 444 microseconds per call is 
surprisingly high for operations that should just be updating counters and 
occasionally sending a window adjust message.
   What I Optimized:
   1.Removed AtomicLong (redundant inside synchronized block)
   2.Increased threshold from 16KB to 128KB
   3.Added early exit for quick return when below threshold
   4.Simplified shouldAdjust logic to only adjust when window < 50%
   Result: Reduced overhead from 444us → <100us per call, reducing frequency 
from ~257 calls/5s → ~40 calls/5s. Upload speeds restored to 2.13.2 levels.
   Question for You:
   Is 444 microseconds per release() call expected? That seems high for 
operations that are primarily:
   A few counter updates
   Occasional sendWindowAdjust() call
   Is there possibly some network I/O or other heavyweight operation happening 
inside sendWindowAdjust() that could accumulate when called 257 times per 5 
seconds?
   I'm happy to provide more detailed profiling data  if that would help 
identify what changed.
   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]

Reply via email to