hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [HttpCommon] Poor performance of chunked streams
Date Sun, 21 Aug 2005 13:08:33 GMT
Folks,

Once again NIO proves full of surprises. After having experimented with
chunked streams a little more I discovered that the problem is fact once
again lied with NIO. It turned out that NIO performs absolutely dismally
when the socket receive and send buffers are relatively small. With 2048
byte receive and send buffers NIO tends to perform several THOUSAND
times slower than with 20480 buffers. 

Check this out:
==============================
RCV_BUFFER_SIZE: 2048
Old IO average time (ms): 3301
Blocking NIO average time (ms): 6515
NIO with Select average time (ms): 15395

RCV_BUFFER_SIZE: 20480
Old IO average time (ms): 2
Blocking NIO average time (ms): 2
NIO with Select average time (ms): 3
==============================
Source [1]

I have also compiled another bunch of test cases intended to test
performance of various read operations. Interestingly enough, but not
entirely unexpectedly, NIO handsomely outperforms classic IO when
reading single bytes and lines of text:

==============================
Old IO byte array read average time (ms): 246
NIO byte array read average time (ms): 216
Old IO one byte read average time (ms): 537
NIO one byte read average time (ms): 178
Old IO one line read average time (ms): 340
NIO one line read average time (ms): 77
==============================
Source [2]

Please let me know if you can spot any flaws in the test cases

Cheers,

Oleg

[1]
http://svn.apache.org/repos/asf/jakarta/httpclient/trunk/http-common/src/test/tests/performance/RawNIOvsRawOIOTest.java
[2]
http://svn.apache.org/repos/asf/jakarta/httpclient/trunk/http-common/src/test/tests/performance/HttpNIOvsHttpOIOTest.java

On Sat, 2005-08-20 at 22:01 +0200, Oleg Kalnichevski wrote:
> Folks,
> 
> I have just identified another problem with HttpCommon code, which
> causes massive performance degradation when streaming in or out chunked
> data. I also suspect HttpDataReceiver and HttpDataTransmitter interfaces
> will have to be completely rethought. Since it is very rainy and cold
> here, and the weekend looks all but ruined, I guess this is just the
> perfect opportunity to get some code fixed ;-)
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message