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 2006/11/14 18:04:51 UTC

[HttpCore] NIO extensions: InputStream / OutputStream compatibility layer

Folks,

I have completed the InputStream / OutputStream compatibility layer on
top of the lower level event-driven API. It actually proved quite a bit
more difficult that I initially thought. 

I wanted to meet several primary design objectives:

(1) Ensure that HTTP connections can operate with a constant memory
footprint. Connections should attempt to grab largish but bounded
content buffers upon startup and terminate if unable to do so prior to
accepting the incoming request, thus giving the affected client a chance
to recover cleanly and retry the connection. 

(2) HTTP connections can never go down with OutOfMemoryException after
having sent an 2xx response while streaming out the response content.
Content buffers can never expand.

(3) Individual workers can block temporarily if unable to consume
incoming content or if they produce more outgoing content than the
content buffer can hold

(4) Individual connections do not block the I/O reactor (and thus other
connections) when unable to deal with content volume.

As a consequence of these design objectives AsyncHttpService implies the
use of a worker thread per request / response exchange, but the worker
threads can be released before the response content is fully streamed
out.   

More testing and more polish is definitely needed but so far it appears
to hold up reasonably well for a first cut. 

Here's the sample async HTTP server for an early feel of the new API

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

As always some feedback would be hugely appreciated. Please let me know
what you think.

Cheers

Oleg


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