Overview
Features
Download
Documentation
Community
Add-Ons & Services

HTTPServer performance

Please post support and help requests here.

HTTPServer performance

Postby aderouineau » 19 May 2009, 19:56

Does the HTTPServer class perform well?
It uses multiple threads and the doc seems to mention that each thread can handle multiple connection, but I'd like to be clarified.

I plan on using it for a bittorrent tracker that will need to handle a lot of concurrent connections.

Thanks for the help!

PS: I was also wondering how the performance would be like with the apache connector (much better than a standalone app?)
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: HTTPServer performance

Postby guenter » 19 May 2009, 20:44

The performance of the HTTP server should be in the same ballpark as Apache's performance, based on performance tests some time ago. It's multithreaded, with every request handled by a separate thread, so it should handle up to 100 or more concurrent connections fine. Threads are pooled, so and requests are distributed to threads using a queue, so even temporary peaks of load can be handled fine. If you have 10000's of connections simultaneously, then you'd be better of with a HTTP server based on an asynchronous I/O model.
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: HTTPServer performance

Postby aderouineau » 19 May 2009, 21:00

So unlike what the doc seems to be implying (that each thread can handle multiple connections) it's really one connection per thread (absolutely no async IO)? That's rather strange for a library that seeks performance not to have async IO...

What project would you thus recommend for a c++ API that provides async and threads?
ASIO is pretty complicated.
I also need HTTP and HTTPS to run concurrently.

Also, you say performance is equivalent to apache's, but doesn't apache use async IO on top of threads?
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: HTTPServer performance

Postby alex » 19 May 2009, 22:20

aderouineau wrote:So unlike what the doc seems to be implying (that each thread can handle multiple connections) it's really one connection per thread (absolutely no async IO)?

Where is that in the documentation?
aderouineau wrote:That's rather strange for a library that seeks performance not to have async IO...

We have people all the time fussing about things not being implemented. Do not get me wrong, all those things are good and desirable, but they take time to implement. On the commercial front, POCO primarily targets embedded and async IO turns out not to be a mission-critical feature.
aderouineau wrote:What project would you thus recommend for a c++ API that provides async and threads?
ASIO is pretty complicated.
I also need HTTP and HTTPS to run concurrently.

May be hard to find. If you want to help, I have done some async IO work and plan some more, so let me know. Alternatively, you may explore the Poco::Net::SocketReactor route - it was recently extended with poll() support (for the platforms that support it).
aderouineau wrote:Also, you say performance is equivalent to apache's, but doesn't apache use async IO on top of threads?

I am not aware of this being the case (although I am not 100% certain it s not, either). I think that web sites under lot of load do the load balancing with multiple servers to address the performance problem.

Prompted by this Apache/Yaws comparison, I have ran some tests few years ago on 64-bit Linux. Poco and Apache have performed roughly the same and crashed under load when too many threads were launched. Yaws would not crash, but it would go to sleep for a long time when overloaded. Where Yaws really sucked was that (1) it was slower than POCO/Apache and (2) it would silently send just a fragment of the requested file it was too big (well, around 1MB, but if you have to copy everything all the time, that'sa lot). I do regret I did not spend more time on it and put together a decent report.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: HTTPServer performance

Postby guenter » 19 May 2009, 22:26

AFAIK Apache uses either the worker threads model, which works similar to POCO's server, or the old preforked model, with one process per connection.

Regarding async I/O: Async I/O is a very complicated programming model, and no library is able to abstract away that complexity. We have some plans for async I/O in POCO, but don't expect anything in the near future.
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: HTTPServer performance

Postby aderouineau » 19 May 2009, 23:04

alex wrote:
aderouineau wrote:So unlike what the doc seems to be implying (that each thread can handle multiple connections) it's really one connection per thread (absolutely no async IO)?

Where is that in the documentation?

Perhaps that was a misunderstanding on my part. The doc of TCPServer says: "Thus, a connection thread may serve more than one connection."
I think I get what was meant now :)


aderouineau wrote:What project would you thus recommend for a c++ API that provides async and threads?
ASIO is pretty complicated.
I also need HTTP and HTTPS to run concurrently.

May be hard to find. If you want to help, I have done some async IO work and plan some more, so let me know. Alternatively, you may explore the Poco::Net::SocketReactor route - it was recently extended with poll() support (for the platforms that support it).

So Reactor uses polling for handling async connections. That means the HTTPServer class becomes obsolete for what I want to do, and I have to write all the code to handle HTTP myself? Or is there a way to reuse HTTPRequest and HTTPResponse with Reactor?

I just read in your blog about AsyncIO. How does it differ from Reactor?
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: HTTPServer performance

Postby aderouineau » 20 May 2009, 00:00

I just realized that the blog post was from 2007. What happened to that project? Was it basically superseeded by Reactor?
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: HTTPServer performance

Postby alex » 20 May 2009, 00:08

aderouineau wrote: Or is there a way to reuse HTTPRequest and HTTPResponse with Reactor?

Probably, but I don't have a ready to use recipe of the top of my head (maybe Guenter has something somewhere). Look at EchoServer example for TCP reactor server.
aderouineau wrote:I just read in your blog about AsyncIO. How does it differ from Reactor?

You may be referring to Guenter's blog about his weekend hack. That is thread-based, so it suffers from all the associated ills. The async IO done right (if there is such a thing) would implement the Proactor pattern.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: HTTPServer performance

Postby alex » 20 May 2009, 00:12

aderouineau wrote:I just realized that the blog post was from 2007. What happened to that project? Was it basically superseeded by Reactor?

It's in the sandbox. That is thread-based.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: HTTPServer performance

Postby aderouineau » 20 May 2009, 00:32

So the Async stuff posted in the blog is a false async, by using threads?

Would the Reactor allow the handling of many concurrent (small-burst) connections for a torrent tracker?

Thanks for your help :)
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Next

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest