Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rgrinberg
Copy link

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

@elprans
Copy link
Member

elprans commented May 5, 2016

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()

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

@creationix
Copy link

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.
rgrinberg added 3 commits May 6, 2016 00:22
Should listen on the correct interfaces 0.0.0.0 rather than localhost.
@rgrinberg
Copy link
Author

@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.

@creationix
Copy link

@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 ("")to signify the end of body for keepalive support which is essential to winning these kinds of synthetic benchmarks.

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.

@creationix
Copy link

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.

@creationix
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants