vmbench icon indicating copy to clipboard operation
vmbench copied to clipboard

Add luvit implementations for echo & http servers

Open rgrinberg opened this issue 9 years ago • 6 comments

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

rgrinberg avatar May 05 '16 01:05 rgrinberg

Please do update the Dockerfile to build luvit properly. There doesn't seem to be a .deb for 16.04.

elprans avatar May 05 '16 17:05 elprans

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.

creationix avatar May 05 '16 18:05 creationix

@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 avatar May 06 '16 12:05 rgrinberg

@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 avatar May 06 '16 14:05 creationix

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 avatar May 06 '16 14:05 creationix

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.

creationix avatar May 06 '16 14:05 creationix