-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Developing an http server using libmill #161
Comments
Excellent idea! I'm looking at developing a http/2 server using nghttp2 (so that the hardwork is done for me already). However, nghttp2 does not support http/1.1. It should, in theory, be faster. My preliminary microbenchmark helloworld put a nghttp2 server (with single thread/1 stream) only 20% behind lwan which arguably is the fastest web server for raw-http/1.1 serving. This is with lwan's highly optimised http parsing implementation etc. whereas http2 is a more complicated protocol and nghttp2's implementation has been aiming for correctness rather than raw performance (as yet). See #155. In terms of the performance from actual https://github.com/jamel/go-perf-tests On my $ ./ctxswitch 10
performed 10M context switches in 3.101000 seconds
duration of one context switch: 310 ns
context switches per second: 3.225806M On my $ ./ctxswitch 10
performed 10M context switches in 0.289000 seconds
duration of one context switch: 28 ns
context switches per second: 35.714283M On an older $ ./perf/ctxswitch 10
performed 10M context switches in 0.420000 seconds
duration of one context switch: 42 ns
context switches per second: 23.809525M Which basically makes context switching costs almost negligible across x86-64 platforms! The implementation of the context switching may even be faster than lwan's due to inlining... but I haven't tested this. |
@sustrik Can you tag these issues as "questions" on github. |
Done! |
The application server should work in all major browsers. Can nghttp2 handle requests from http/1.1 clients? What about support for SSL and WebSockets? |
nghttp2 does not handle http/1.1 requests, but fasthttp doesn't handle http/2 requests either.
Support for ssl/tls is ongoing: #152
nghttp2 doesn't need porting, just needs a libmill backend and a new frontend unless you want to reimplement it from scratch (to better integrate http/1.1, http/2 and libmill under a cohesive API). Use cases Eventual Architecture? In my mind, I envisioned a complete web server to involve a series of binaries (to follow the UNIX principle). Main points are:
|
Most of the modern JavaScript libraries/frameworks don't work in older browsers. So, now a days, web application developers focus on relatively new browsers only. So, it is a good idea to focus on HTTP/2.
How can I help you now? Or do you have any other tasks in your mind for me? |
I'm currently busy for the next 10 days or so but the initial tasks that need to be done for HTTP/2 are:
|
SSL, ALPN and SNI are new to me for implementing. So, I need to get familiarize to those at first.
Here too, I need to get familiarize things at first. |
We were thinking that the best approach would be to port the code from libtls and link with openssl/libressl, whichever is available on the target system. |
|
If your distribution has libressl, libtls is built along with it. For example see: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=libressl
Pretty much and matching the API in the similar way to the one I gave here: #152 (comment) If your distribution uses OpenSSL, some of the headers will be different to libressl (distinguish using an P.S. There may be mistakes in the API, but the general idea is there. |
I am lurking on IRC: ##libmill on freenode today if anyone wants a quick chat. |
Thanks. IRC will be helpful. I was busy today. See you there in coming days. |
There's a node.js implementation; Node.js also uses asynchronous I/O calls so in theory some of the design concepts from that implementation could be useful. |
Normally |
Although perhaps implementing it directly from the RFC would be better, then we have a full understanding of the quirks, performance etc. https://tools.ietf.org/rfc/rfc7540.txt |
I think, referring both RFC and a working C implementation would be better. Meanwhile, I am familiarizing the afore mentioned technologies and doing some research on network and file access performance improvement. My primary focus on Performance and Scalability. |
Closing old issues. |
Has anyone made some progress in implementing a I've been fooling with it, but haven't gotten too far. My poor, unoptimized, incorrect toy implementation isn't going as fast as I'd hoped. hahaha... Anecdotal toy benchmarks are here: https://github.com/ubergarm/binks Any pointers or more |
The saga continues! Pretty sure my benchmarks were way off because I scratched everything and will try some more. Gonna earn my grey hairs trying to figure this stuff out... ;) |
I would like to develop an http server using libmill. As a first step, I am planning to port an existing go based http server library using libmill. (https://github.com/valyala/fasthttp) Is it a good idea? Will I get more performance than Go? (I am expecting more performance since this web server will be in C)
I hope, the porting will be easy as there is 1:1 mapping of concurrency model.
And I would like to port this (new webserver) code to libdill once it is matured.
The text was updated successfully, but these errors were encountered: