You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2005/09/02 22:31:57 UTC

[HttpCommon] Classic IO code refactored

Folks,

I have completely refactored the HTTP data receiver and transmitter
classes based on the classic IO. As incredible as it may sound this
resulted in almost four-fold performance improvement on one byte and
line read operations. Now classic IO completely decimates NIO on my
Linux box

Before refactoring
=================
Old IO byte array read average time (ms): 208
NIO byte array read average time (ms): 212
Old IO one byte read average time (ms): 642
NIO one byte read average time (ms): 176
Old IO one line read average time (ms): 819
NIO one line read average time (ms): 326

After refactoring
=================
Old IO byte array read average time (ms): 193
NIO byte array read average time (ms): 209
Old IO one byte read average time (ms): 107
NIO one byte read average time (ms): 173
Old IO one line read average time (ms): 164
NIO one line read average time (ms): 328

Source:
http://svn.apache.org/repos/asf/jakarta/httpclient/trunk/http-common/src/test/tests/performance/HttpNIOvsHttpOIOTest.java

In my opinion there's no longer a single reason to keep NIO in the
HttpCommon package

Oleg
PS: I'll be on vacation from tomorrow until next Saturday, Sept 10th.
Talk to you in a week


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


Re: [HttpCommon] Classic IO code refactored

Posted by Oleg Kalnichevski <ol...@apache.org>.
Hi Mike,

NIO code can still be optimized. However, I seriously doubt it would
ever outperform classic IO to an extent significant enough to justify
the absence of timeout support. NIO  increasingly appears useless
outside HttpAsync where it can be used in the non-blocking mode. I
suggest all NIO code be eventually removed from HttpCommon and put in
HttpAsync

Oleg

On Fri, 2005-09-02 at 18:01 -0400, Michael Becke wrote:
> My results are similar.
> 
> Old IO byte array read average time (ms): 844
> NIO byte array read average time (ms): 875
> Old IO one byte read average time (ms): 156
> NIO one byte read average time (ms): 234
> Old IO one line read average time (ms): 156
> NIO one line read average time (ms): 203
> 
> I don't see anything strang with the NIO code, it just feels like
> there must be something wrong.  Perhaps that's why Sun chose NIO
> instead of something else like FastIO :)
> 
> Mike
> 
> On 9/2/05, Oleg Kalnichevski <ol...@apache.org> wrote:
> > Folks,
> > 
> > I have completely refactored the HTTP data receiver and transmitter
> > classes based on the classic IO. As incredible as it may sound this
> > resulted in almost four-fold performance improvement on one byte and
> > line read operations. Now classic IO completely decimates NIO on my
> > Linux box
> > 
> > Before refactoring
> > =================
> > Old IO byte array read average time (ms): 208
> > NIO byte array read average time (ms): 212
> > Old IO one byte read average time (ms): 642
> > NIO one byte read average time (ms): 176
> > Old IO one line read average time (ms): 819
> > NIO one line read average time (ms): 326
> > 
> > After refactoring
> > =================
> > Old IO byte array read average time (ms): 193
> > NIO byte array read average time (ms): 209
> > Old IO one byte read average time (ms): 107
> > NIO one byte read average time (ms): 173
> > Old IO one line read average time (ms): 164
> > NIO one line read average time (ms): 328
> > 
> > Source:
> > http://svn.apache.org/repos/asf/jakarta/httpclient/trunk/http-common/src/test/tests/performance/HttpNIOvsHttpOIOTest.java
> > 
> > In my opinion there's no longer a single reason to keep NIO in the
> > HttpCommon package
> > 
> > Oleg
> > PS: I'll be on vacation from tomorrow until next Saturday, Sept 10th.
> > Talk to you in a week
> > 
> > 
> > ---------------------------------------------------------------------
> > 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
> 
> 


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


Re: [HttpCommon] Classic IO code refactored

Posted by Michael Becke <mb...@gmail.com>.
My results are similar.

Old IO byte array read average time (ms): 844
NIO byte array read average time (ms): 875
Old IO one byte read average time (ms): 156
NIO one byte read average time (ms): 234
Old IO one line read average time (ms): 156
NIO one line read average time (ms): 203

I don't see anything strang with the NIO code, it just feels like
there must be something wrong.  Perhaps that's why Sun chose NIO
instead of something else like FastIO :)

Mike

On 9/2/05, Oleg Kalnichevski <ol...@apache.org> wrote:
> Folks,
> 
> I have completely refactored the HTTP data receiver and transmitter
> classes based on the classic IO. As incredible as it may sound this
> resulted in almost four-fold performance improvement on one byte and
> line read operations. Now classic IO completely decimates NIO on my
> Linux box
> 
> Before refactoring
> =================
> Old IO byte array read average time (ms): 208
> NIO byte array read average time (ms): 212
> Old IO one byte read average time (ms): 642
> NIO one byte read average time (ms): 176
> Old IO one line read average time (ms): 819
> NIO one line read average time (ms): 326
> 
> After refactoring
> =================
> Old IO byte array read average time (ms): 193
> NIO byte array read average time (ms): 209
> Old IO one byte read average time (ms): 107
> NIO one byte read average time (ms): 173
> Old IO one line read average time (ms): 164
> NIO one line read average time (ms): 328
> 
> Source:
> http://svn.apache.org/repos/asf/jakarta/httpclient/trunk/http-common/src/test/tests/performance/HttpNIOvsHttpOIOTest.java
> 
> In my opinion there's no longer a single reason to keep NIO in the
> HttpCommon package
> 
> Oleg
> PS: I'll be on vacation from tomorrow until next Saturday, Sept 10th.
> Talk to you in a week
> 
> 
> ---------------------------------------------------------------------
> 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