You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Dmitrii Novikov (Jira)" <ji...@apache.org> on 2021/12/02 13:50:00 UTC

[jira] [Updated] (DIRMINA-1152) IoServiceStatistics introduces huge latencies

     [ https://issues.apache.org/jira/browse/DIRMINA-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitrii Novikov updated DIRMINA-1152:
-------------------------------------
    Description: 
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. You can read about benchmark details in the README file.

 

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.

  was:
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.


> 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 Novikov
>            Priority: Major
>
> 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. You can read about benchmark details in the README file.
>  
> 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: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org