You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Robert Brown <ro...@gmail.com> on 2007/09/24 17:27:58 UTC

NIO HttpCore stability

I'm considering using the latest NIO HttpCore code and I'd like
to get a rough idea of how stable it is for the use case
described below.  The basic question is: Would you feel
comfortable basing a heavily used production system on it at this
time, if you were willing to do some debugging of problems?

My application currently uses HttpClient 3.x to connect to
thousands of different HTTP servers over SSL (not all at once).
The system POSTs 4K to 10K of data to a server after
authenticating using basic auth.  The reason for considering the
switch to NIO HttpCore is to improve performance.  Under heavy
load, when the servers fielding the POSTs become slow, threads
stay blocked for too long and the system runs out of threads
doing useful work.  The current system does not stay connected to
an HTTP server between requests.  Doing so might improve things,
since some servers need to be sent many more messages than
others.

The servers fielding the POSTs are implemented using a variety of
different HTTP server software.  The program sending the POSTs is
heavily loaded.

Is the NIO HttpCore currently stable enough to try using for an
application like this?  What sort of problems am I likely to
encounter?  Thanks very much.

bob

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


Re: NIO HttpCore stability

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Bob

We are using HttpCore NIO and the SSL extensions for Apache Synapse 
which is an ESB. The reason for us to move to NIO was similar to your 
case, as we cannot leave threads waiting for responses. From the 
performance tests we have done so far we are very happy with HttpCore. 
We had some issues on older SunOS 5.8 systems etc, and probably may 
encounter the epoll issues mentioned by Robert Olofsson. Oleg has been 
very supportive and was able to fix the SunOS issue etc. very quickly 
for us and get us other enhancements into HttpCore as well. From 
possible different implementations around for NIO, we tried out many - 
and even attempted to write our own - but soon realized that HttpCore is 
the best implementation one would find out there. You will notice many 
architectural decisions (when comparing to other implementations - e.g. 
streaming requests instead of reading everything into memory) and 
extremely good code quality in this. Also if you do decide to use 
HttpCore-NIO, it would help us improve it even better for your benefit 
and for many other projects in future.

asankha

Robert Brown wrote:
> I'm considering using the latest NIO HttpCore code and I'd like
> to get a rough idea of how stable it is for the use case
> described below.  The basic question is: Would you feel
> comfortable basing a heavily used production system on it at this
> time, if you were willing to do some debugging of problems?
>
> My application currently uses HttpClient 3.x to connect to
> thousands of different HTTP servers over SSL (not all at once).
> The system POSTs 4K to 10K of data to a server after
> authenticating using basic auth.  The reason for considering the
> switch to NIO HttpCore is to improve performance.  Under heavy
> load, when the servers fielding the POSTs become slow, threads
> stay blocked for too long and the system runs out of threads
> doing useful work.  The current system does not stay connected to
> an HTTP server between requests.  Doing so might improve things,
> since some servers need to be sent many more messages than
> others.
>
> The servers fielding the POSTs are implemented using a variety of
> different HTTP server software.  The program sending the POSTs is
> heavily loaded.
>
> Is the NIO HttpCore currently stable enough to try using for an
> application like this?  What sort of problems am I likely to
> encounter?  Thanks very much.
>
> bob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
>
>
>   

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


Re: NIO HttpCore stability

Posted by Robert Olofsson <ro...@khelekore.org>.
Robert Brown wrote:
> Is the NIO HttpCore currently stable enough to try using for an
> application like this?  What sort of problems am I likely to
> encounter?  Thanks very much.
>   
I can not speak for HttpCore, but I can speak for nio in java/linux.

If you run on linux, then be aware that java/6.0 up to 6u3 seems to
have some bugs in the epoll selector handling.

This one, fixed in 6u1, causes random IOExceptions:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6481709

This one. fixed in 7b12 and will be in 6u4 (or maybe 6u3),
causes the selector to trigger constantly giving you selector spin (100% 
cpu):
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6403933

Depending on how defensivly you code you may be able to work
around both of the bugs.

If you run on windows or solaris you also seem to be safe (since I
run neither I have not looked for bugs in them). If you are on linux
you could either stay with java/5 or you can tell the jvm to use the old
selector.

/robo


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


Re: NIO HttpCore stability

Posted by Roland Weber <os...@dubioso.net>.
Hello Robert,
> providing an SSLContext instance to the HttpCore code. [...]
> With HttpClient all the details are handled for me.

As Odi pointed out, not-yet-commons-ssl should be your friend.
You still have to prepare the SSLContext, but the details of
the key files will be hidden.

> My other requirement is support for connection proxies.  Although
> HttpExecutionContext defines a HTTP_PROXY_HOST constant, I
> haven't found any other code that handles managing the proxy
> connection. Is there any code for doing this?  Perhaps there's
> some alpha code in HttpClient 4.

There's not much to manage for plain HTTP. You connect to the
proxy instead of the target server and send the request there.
You have to put the full URL into the request line, not just
the path as for a direct connection.
For SSL connections through proxies, things get trickier. Have
a look at DefaultClientRequestDirector in HttpClient 4.0. That
code cannot be used directly for NIO, since it uses blocking IO.
But you'll see how to establish a tunnel for the SSL connection.

hope that helps,
  Roland


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


Re: NIO HttpCore stability

Posted by Ortwin Glück <od...@odi.ch>.

Robert Brown wrote:
> I'll have to do a bit of reading to
> understand how SSL key files work. 

Commons-SSL comes to mind:
http://juliusdavies.ca/commons-ssl/

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
       finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416

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


Re: NIO HttpCore stability

Posted by Robert Brown <ro...@gmail.com>.
First, thanks to everyone who responded to my query.  Your
comments are very helpful.

After playing around with HttpCore for a day, I've noticed that I
have a couple of requirements that may not be handled by
HttpCore "out of the box."

The first is SSL connections.  I have grabbed a copy of Apache
Synapse, which Asankha mentioned uses HttpCore to make SSL client
connections.  The key here is providing an SSLContext instance to
the HttpCore code.  I'll have to do a bit of reading to
understand how SSL key files work.  With HttpClient all the
details are handled for me.

My other requirement is support for connection proxies.  Although
HttpExecutionContext defines a HTTP_PROXY_HOST constant, I
haven't found any other code that handles managing the proxy
connection.  Is there any code for doing this?  Perhaps there's some
alpha code in HttpClient 4.

bob

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


Re: NIO HttpCore stability

Posted by Sam Berlin <sb...@gmail.com>.
LimeWire also uses HttpCore & the HttpNIO API.  We shipped a major
release with it and have not seen any problems (major or minor).  One
key difference is that we do *not* use HttpNIO's selector/channel
handling, we plugged in our own implementation that was already in use
for the rest of LimeWire.  The good side of that means the HttpNIO API
and code is very capable and can work with different NIO
implementations, but the downside (for you) is that I can't say we've
tested that part of it.

Sam

On 9/25/07, Roland Weber <os...@dubioso.net> wrote:
> Robert Brown wrote:
> > I'm considering using the latest NIO HttpCore code and I'd like
> > to get a rough idea of how stable it is for the use case
> > described below.
>
> In terms of API stability, we're closing in on the beta,
> most likely later this year. Synapse has been using HttpNIO
> since alpha3 or so. They had to update their code on a
> regular basis because of the API changes, but these are
> going to be a thing of the past when we go beta.
>
> > The basic question is: Would you feel
> > comfortable basing a heavily used production system on it at this
> > time, if you were willing to do some debugging of problems?
>
> That depends on the quality of your tests. We do have some
> unit tests at the moment, but they do not have the coverage
> to call the code production ready. I believe the code is of
> very good quality and has not many bugs left. Nevertheless
> I expect that it will take another year for going from beta
> to final. (We're spending our spare time here.)
> If you are prepared to test your specific use cases well,
> you can build a production system on top of HttpCore. And
> it would be great for all users if you contributed test
> cases back to the project. Once we have test cases, we'll
> make sure they all pass for every future release.
>
> If you can wait until next week, Oleg is going to comment
> on this question too. He's done most of the HttpNIO coding.
>
> cheers,
>  Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
>
>

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


Re: NIO HttpCore stability

Posted by Roland Weber <os...@dubioso.net>.
Robert Brown wrote:
> I'm considering using the latest NIO HttpCore code and I'd like
> to get a rough idea of how stable it is for the use case
> described below.

In terms of API stability, we're closing in on the beta,
most likely later this year. Synapse has been using HttpNIO
since alpha3 or so. They had to update their code on a
regular basis because of the API changes, but these are
going to be a thing of the past when we go beta.

> The basic question is: Would you feel
> comfortable basing a heavily used production system on it at this
> time, if you were willing to do some debugging of problems?

That depends on the quality of your tests. We do have some
unit tests at the moment, but they do not have the coverage
to call the code production ready. I believe the code is of
very good quality and has not many bugs left. Nevertheless
I expect that it will take another year for going from beta
to final. (We're spending our spare time here.)
If you are prepared to test your specific use cases well,
you can build a production system on top of HttpCore. And
it would be great for all users if you contributed test
cases back to the project. Once we have test cases, we'll
make sure they all pass for every future release.

If you can wait until next week, Oleg is going to comment
on this question too. He's done most of the HttpNIO coding.

cheers,
  Roland

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