5 ms·
With Rust's switch to 1:1 threading (soon to be not even optional AFAIK), how will this affect the concurrency capabilities of Rust-based web servers, and serve
by m0th87 12y ago
With Rust's switch to 1:1 threading (soon to be not even optional AFAIK), how will this affect the concurrency capabilities of Rust-based web servers, and servers in general?
- Shamanmuni 12y agoAFAIK green threads were removed from the core language but are available as crate green (also known as greenlib). You can use that for building servers. http://doc.rust-lang.org/green/ http://doc.rust-lang.org/green/
- ben0x539 12y ago*libgreen They're gonna get yanked out of the core distribution too and won't be integrated in the stdlib IO anymore, so it's fair to say that Rust is switching to 1:1 threading.
- kaoD 12y agoAny reason why? I'd love to read some discussion about it.
- ben0x539 12y agoSince both threading models were supported and compatible throughout IO, concurrency primitives and other runtime bits, the design of both was considered to be constrained too much to get either model where it should be. The decision was made around https://github.com/rust-lang/rfcs/pull/230 https://github.com/rust-lang/rfcs/pull/230 but I'm not sure whether there's any important prior discussion not linked from there, the topic has been kicked around for a bit.
- steveklabnik 12y agoWe talked about it at the last work week a lot https://github.com/rust-lang/meeting-minutes/blob/master/workweek-2014-08-18/libgreen-and-tls-redux.md https://github.com/rust-lang/meeting-minutes/blob/master/wor...
- deleted 12y ago[deleted]
- 15020 12y agoIt will have the same problems as any other webserver utilizing blocking IO. Various people are working on async IO solutions; but it likely won't fall into the stdlib from what I can tell. I'm currently working on a rust abstraction for epoll and kqueue to eventually be paired with a multithreaded event loop/reactor. Lots of stuff to reimplement.
- rubiquity 12y agoI only play with Rust because I'm a language junky, but I don't think Rust has been built so far with the intentions of being a great language for servers. It feels like a language targeted towards system engineering, which is a bit different than network engineering (which is where I would put web servers). That said, with a 1:1 threading model, you can still build good abstractions for asynchronous I/O onto those threads. Erlang is kind of like this in that it spawns as many threads as you have cores (unless you tell it otherwise) and uses a thread for async I/O via epoll/kqueue.