Dmitrii created DIRMINA-1152:
--------------------------------

             Summary: IoServiceStatistics introduces huge latencies
                 Key: DIRMINA-1152
                 URL: https://issues.apache.org/jira/browse/DIRMINA-1152
             Project: MINA
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.1.4, 2.1.5
            Reporter: Dmitrii


Current implementation of IoServiceStatistics is blocking - it blocks on 
_throughputCalculationLock_ for almost all operations

However, _IoServiceStatistics_ is used by all threads which writes to 
_IoSession_ and by all _NioProcessor_ threads.

Blocking _IoServiceStatistics_ dramatically decreases performance in case of 
multithreaded writing to {_}IoSession{_}.

Please, refer to my 
[benchmark|https://github.com/dmitriinovikov/apache-mina-benchmark] to ensure 
that it is so. The measurements are taken between the time the message was 
written to _IoSession_ by client and the time when it was actually sent to the 
server by _NioProcessor._ Latency percentiles are calculated for all messages 
except the first 20% - consider it as a warmup. 

My benchmark results:
{code:java}
# non-blocking IoServiceStatistics vs blocking IoServiceStatistics:

p50: 85mcs vs 140mcs
p75: 150mcs vs 400mcs
p90: 239mcs vs 905mcs
p95: 319mcs vs 1418mcs
p99: 1311mcs vs 11485mcs {code}
 

As a simple workaround solution, I would suggest to add an option to disable 
_IoServiceStatistics_ or replace it with custom implementation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to