-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add luvit implementations for echo & http servers #6
base: master
Are you sure you want to change the base?
Conversation
Please do update the Dockerfile to build luvit properly. There doesn't seem to be a .deb for 16.04. |
-- Relay data back to client | ||
client:read_start(function(err, data) | ||
if err then | ||
client:close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a return after this close
I love how the tcp test uses luv directly. Can we add another test using coro-http or weblit instead of the http library in luvit? I could even write a minimal http sample using nothing more than http-codec on top of uv. The luvit streams (modeled after node.js) are pretty heavy. Also most new luvit code these days is using the coroutine bases stuff anyways. |
Since we are comparing nodejs and its uv bindings, it would be interesting to see how lua's libuv bindings compare.
Should listen on the correct interfaces 0.0.0.0 rather than localhost.
@elprans dockerfile + benchmarks updated! @creationix I'm happy to do it. Where can I find coro-http? weblit seems pretty straightforward. Are there any examples of using http-codec? I can't find any and it doesn't seem so simple. |
@rgrinberg Weblit uses http-codec under the hood. As does luvit's http and coro-http Between the 3 usages, you should have a good idea of how to use http-codec. The basic idea is to transform a stream of raw tcp bytes into a stream of messages (one for headers and one for each body). There is an empty body ( Coro-net is used by weblit and coro-http where you basically just pass in an instance of the encoder/decoder pair as options and coro-net will automatically apply the codec and give you higher-level events in the read/write streams. |
Also there is this which I wrote a while back when I was benchmarking luvit. https://github.com/luvit/luvit/tree/master/bench/http-cluster I'm not sure if it still works, but the basic idea is to bind to the port in a parent process and launch n child processes who each inherit and share the file descriptor. When connections come in, they will be load balanced by the kernel to whichever process is ready to accept them. This gives near linear speedups if you launch a process per physical CPU core. |
It appears that vmbench wants single-core comparisons. That's fine, just combine worker and master into the same process (bind, listen, and accept all in one process) and otherwise the code would be about the same. |
Since we are comparing nodejs and its uv bindings, it would be interesting to see how lua's libuv bindings compare.
If you're interested in this addition, I will try and update the dockerfile as well. Although I'm currently running into problems setting it up #5