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 2007/12/08 20:40:36 UTC

[HttpCore] NIO FileChannel direct I/O rocks

Folks,

I finally put together an example of HttpCore NIO based HTTP server
optimized for serving static files off the disk:

https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java

The code is not pretty. There are lots of instanceof checks all over the
place, but according to my (very unscientific) performance benchmarks
the use of FileChannel direct I/O seems to result in a 60% performance
improvement even for fairly small files (12K). I'll try to run a little
more systematic tests and put the results on wiki. Overall, it looks NIO
might even outperform classic I/O when used to serve static content off
the disk.

I thought some people might be interested to hear that.

Oleg



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


Re: [HttpCore] NIO FileChannel direct I/O rocks

Posted by Paul Fremantle <pz...@gmail.com>.
Wow! Nice one :)

Very interesting too.

Paul

On Dec 8, 2007 7:40 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

> Folks,
>
> I finally put together an example of HttpCore NIO based HTTP server
> optimized for serving static files off the disk:
>
>
> https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
>
> The code is not pretty. There are lots of instanceof checks all over the
> place, but according to my (very unscientific) performance benchmarks
> the use of FileChannel direct I/O seems to result in a 60% performance
> improvement even for fairly small files (12K). I'll try to run a little
> more systematic tests and put the results on wiki. Overall, it looks NIO
> might even outperform classic I/O when used to serve static content off
> the disk.
>
> I thought some people might be interested to hear that.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> httpcomponents-dev-help@jakarta.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com