rouille icon indicating copy to clipboard operation
rouille copied to clipboard

[WIP] Use mio instead of tiny-http

Open tomaka opened this issue 8 years ago • 7 comments

cc #27

tomaka avatar Aug 08 '17 15:08 tomaka

What's the status on this work? It could be good to combine this with #154 as a new major version (realistically for a major version bump I'd drop rustc-serialize entirely).

cardoe avatar Oct 27 '17 14:10 cardoe

The code here is working, but it's not tested. I was more or less hoping that Rust would support generators soon-ish (not async, just coroutines for parsing), but it looks like we're still far away from them.

tomaka avatar Oct 27 '17 14:10 tomaka

What would the process be to get this PR and the Serde PR implemented? These two PRs would be a great boost for the project though I'm sure other concerns come in to play here.

mentalbrew avatar Oct 31 '17 03:10 mentalbrew

Well the Serde update is ready for review. It has obvious backwards compat issues so there is a question there.

cardoe avatar Oct 31 '17 04:10 cardoe

So the problem with this PR right now is that it breaks websockets. Websockets is a bit tricky because it's touching the topic of asynchronous I/O in Rust.

Other than that, I think there are some minor problems such as HTTP error codes not being returned in some situations (eg. request line too long), and performances could be improved.

tomaka avatar Oct 31 '17 14:10 tomaka

The performance gains from this PR are really impressive! Running the hello-world example goes from 19k req/s to 83k req/s (with wrk -t4 -c100 -d10s)

I did notice two issues though:

  • If a handler panics, the connection hangs. Once the client kills the connection, the cpu usage explodes for all server threads.
  • Performance is great for the first wrk -t4 -c100 -d10s run, but each subsequent run gets worse and worse. (req/s) 83k -> 41k -> 35k -> 32k -> 27k -> 23k -> 22k -> 19k .... eventually down to zero. The server needs to be restarted to reset performance.

jaemk avatar Nov 14 '17 02:11 jaemk

Thanks for the investigation! That's unfortunate.

tomaka avatar Nov 14 '17 08:11 tomaka