william_os4y ([info]william_os4y) wrote,
@ 2006-01-20 22:19:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Threaded versus Event-based web servers

To continue with python webserver tests, I've got the idea compared threaded versus event-based solutions.

If you read the c10k problem, you can see that threaded webservers resists less to a massive concurrent DoS.

I've decided to compare CherryPy, Twisted.web2, Apricot and Asynchronous HTTP with a simple static file.

Every tests have been made localy (webserver and benchmark on the same machine).
Thus, Tests were made with the nice command: nice -n 20 ab2 -n10000 -c100 http://localhost/

WebServer Concurrent Requests per second
CherryPy 1 225
Twisted.web2 1 312
Apricot 1 856
Asynchronous HTTP 1 432
CherryPy 100 234
Twisted.web2 100 429
Apricot 100 1057
Asynchronous HTTP 100 411
CherryPy 500 194
Twisted.web2 500 391
Apricot 500 885
Asynchronous HTTP 500 308

More intersting, we see that event based webservers resist much more to DoS (500 concurrent request) attacks.

WebServer Percentage of the requests served within a certain time (ms)
CherryPy
50% 2016
66% 2303
75% 2331
80% 2352
90% 5000
95% 7023
98% 7580
99% 9043
100% 20396
Twisted.web2
50% 269
66% 321
75% 389
80% 455
90% 3282
95% 3451
98% 9426
99% 12782
100% 17233
Apricot
50% 252
66% 361
75% 412
80% 438
90% 570
95% 3327
98% 3443
99% 3501
100% 3836
Asynchronous HTTP
50% 71
66% 102
75% 156
80% 3027
90% 3087
95% 3687
98% 6545
99% 16950
100% 31160


Annexe:

CherryPy config was:
[global]
server.socketPort = 8081
server.threadPool = 10
server.environment = "production"
server.logFile = "access.log"
server.logToScreen = False
and all html data was directly within a local vairable (not via the static filter).

For the others, the config is the standard one (not modifications).




(6 comments) - (Post a new comment)

Thanks for the benchmark and bringing Apricot to Planet Python
(Anonymous)
2006-06-01 03:58 am UTC (link)
Hi William,

Nice benchmarks. And I did not know about Apricot, which I read and like very much. It's a good example of how to apply libevent bindings to develop fast and scalable servers with less code.

Cordialement,


Laurent

http://laurentszyster.be/blog/

(Reply to this) (Thread)

Re: Thanks for the benchmark and bringing Apricot to Planet Python
(Anonymous)
2006-06-22 02:18 pm UTC (link)
By the way, what's the hardware, system and test condition?

Regards,


Laurent

(Reply to this) (Parent)(Thread)

Re: Thanks for the benchmark and bringing Apricot to Planet Python
[info]william_os4y
2006-06-23 08:54 pm UTC (link)
Hello Laurent,

I have a Gentoo 2.6.15-r1 running Python 2.4.2 on an AMD XP2000+ (1244 MHz, 2492 Bogomips) with 256MB of ram.

Tests were with a simple static html page of 8431 bytes.

(Reply to this) (Parent)

Online Now
(Anonymous)
2007-05-22 03:28 pm UTC (link)
Hello

Nice Website. Wow...i really wish i am so good in allegro like you...
Bye







(Reply to this)

#hostname - The most necessary site !
(Anonymous)
2007-07-31 07:46 am UTC (link)
william-os4y.livejournal.com - The most necessary site


I like your fine site - william-os4y.livejournal.com .

I think it wasnt easy to post here so much information.

Best Regards

Swen

(Reply to this)

Thank You for site
(Anonymous)
2007-08-25 09:43 pm UTC (link)
Thank you for your site. I have found here much useful information.
Good site ! ;)

(Reply to this)


(6 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…