lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

nginx vs lwan on gentoo #2

Closed X4 closed 11 years ago

X4 commented 11 years ago

Specs: Linux 3.8.5-sabayon #1 SMP Fri Mar 29 13:54:29 UTC 2013 x86_64 Genuine Intel(R) CPU U7300 @ 1.30GHz GenuineIntel GNU/Linux gcc-Version 4.7.2 (Gentoo Hardened 4.7.2-r1 p1.5, pie-0.5.5) files_root is on an ext4 partition

weighttp -n 1000000 -c 100 -t 2 -k localhost/index.html Nginx (with default configuration) finished in 80 sec, 511 millisec and 193 microsec, 12420 req/s, 16347 kbyte/s requests: 1000000 total, 1000000 started, 1000000 done, 1000000 succeeded, 0 failed, 0 errored status codes: 1000000 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 1347711247 bytes total, 239711247 bytes http, 1108000000 bytes data

L-WAN (with default configuration) weighttp -n 1000000 -c 100 -t 2 -k localhost:8080/index.html finished in 35 sec, 131 millisec and 940 microsec, 28464 req/s, 37108 kbyte/s requests: 1000000 total, 1000000 started, 1000000 done, 1000000 succeeded, 0 failed, 0 errored status codes: 1000000 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 1335000000 bytes total, 227000000 bytes http, 1108000000 bytes data

L-WAN is ~2.3x faster. Congrats Sir!

Could you tell me more about how you achieve this performance? I've forked your project in order to send in some pull-request whenever I can contribute to lwan, so are there things that need to be done?

X4 commented 11 years ago

I know that lwan's goal is to provide a testbed for multithreaded, event-based programs. And that It is by no means a substitute for real, standards-compliant, web servers. But will you add support for other programming languages? Or maybe one of these or any other features?

Features:
lpereira commented 11 years ago

Partially because nginx isn't only a web server: it does have a very extensible core, and some performance has been traded for flexibility. Lwan, on the other hand, does not do lots of things that nginx do (its architecture isn't flexible), so it ends up being faster. There are lots of other implementation tricks that helps on top of having a simpler, less flexible, architecture; I've made a few blog posts about them (http://tia.mat.br).

Regarding these features you proposed: the first two might be interesting. But creating yet another framework bothers me; would it be possible to support a well-known framework that needs a faster web server?

X4 commented 11 years ago

Thanks for the fast and insightful response, I highly appreciate it. I'll definately check out your blog.

Load-Balancer: Yes I believe you're right, a Load-Balancer isn't really required since haproxy does the job already.

Maintenance Scripts: And Maintainance Scripts could be created easily when there was a Framework within lwan. If there was such a Framework, then you could export the server-status/download count/metrics and many other details not accessible otherwise easily with a (REST-)API. One could create a dashboard with graphs/charts for that, which doesn't need to lay on the same server, thanks to the API.

lpereira commented 11 years ago

Ah, that's what you mean by maintenance scripts. Yes, such things are possible. I've had some proof-of-concept code to perform this (only sending the cumulative number of requests the server has handled so I could calculate the number of request/second in the client); don't remember what was the reason to ditch the code now, though, but I believe it was quite unstable. Found an old screenshot:

If you'd like to work on that, feel free. It would be interesting to also look for an efficient way to save logs as well.

X4 commented 11 years ago

Nice DE, I like awesome, but the never used it long enought to learn the shortcuts. Thanks, I'll dive into your code! Curious on how you solved thing, hehe.

// I'll first check and understand how memory management, process management, request handling is handled in lwan before contributing :)

lpereira commented 11 years ago

The code has never been pushed to the repository, it just lived on my computer. It was pretty simple, but if I had to do it again, I'd use server-sent events or something like that to avoid polling.

Also, check the wip branch if you haven't already. There haven't been much changes recently there, but it is usually more up to date.

X4 commented 11 years ago

Thanks for the check-back, I'll take a look. Am a little busy atm, but lwan and nxweb are certainly really interesting projects.

lpereira commented 11 years ago

I'm closing this due to no activity; feel free to open another issue if needed.