5 ms·
Rust seems like the right answer for a lot of things except writing servers. For that, Elixir with its Erlang VM seems like a better answer.
by youeseh 8y ago
Rust seems like the right answer for a lot of things except writing servers. For that, Elixir with its Erlang VM seems like a better answer.
- staticassertion 8y agoI've been writing servers in Rust and I don't really agree. Granted, these may not be traditional HTTP servers - they're AWS lambdas, which puts them closer to the "some function" than "some server" depending on how you look at it. They work great, I've been able to iterate extremely quickly on a system that has had its requirements changed quite a lot over time. I haven't spent much time optimizing my code at this point but they execute extremely quickly, much faster than my Python lambdas. Regarding the author's complaints: I haven't needed any async. I use threads and it's fine. When async/await is a thing I'll use it, maybe - I really don't think it's going to make a difference but it might free up some memory that I can throw at caching. Error handing in Rust is still a bit uncomfortable. The failure crate has been working for me but it doesn't always feel 'right'.
- dnautics 8y ago> they're AWS lambdas those are not servers! In fact the branding of AWS lambda is exactly "serverless". You don't have to have process restart logic, they're very transient, if a process error causes a crash (yes that happens even in rust) the entire thing is taken down. They're less of a server than a kubernetes-orchestrated container.
- staticassertion 8y agoSure, sorry, I meant services where I wrote "servers" and it's likely the person I responded to did as well. I don't think it changes anything about what I said - process restarts aren't something I'd care about the language for anyways, I'd have a sidecar for that.
- youeseh 8y agoHey there, yes. I guess I meant "services" / servers. I suppose from my point of view - small fish in the ocean - I suppose Rust services running on lambda would be a-ok. I'd love to learn more about how you build and deploy. Do you have any favorite articles / resources that I should look at?
- steveklabnik 8y agoHere’s my favorite success story about Rust on lambda: https://andre.arko.net/2018/10/25/parsing-logs-230x-faster-with-rust/ https://andre.arko.net/2018/10/25/parsing-logs-230x-faster-w... This is before they offered official support though. Here’s the announcement for that, which links to resources: https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws-lambda/ https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws...
- youeseh 8y agoHey, thanks! =)
- staticassertion 8y agohttps://insanitybit.github.io/2018/11/05/deploying-grapl-with-aws-cdk https://insanitybit.github.io/2018/11/05/deploying-grapl-wit... Here's a post on how I use AWS's "Cloud Development Kit" to do my deployments. Builds are through Docker. Source code: https://github.com/insanitybit/grapl https://github.com/insanitybit/grapl
- youeseh 8y agoRight on! Thank you =)
- izend 8y agoI'm just learning Rust right now and my initial thoughts are exactly your sentiment. Writing a backend for Websockets is so easy in Erlang/Elixir, seems a lot more difficult in Rust. Now, the performance of Rust is aspect that Erlang/Elixir will never close to reaching.
- adamnemecek 8y agoAre you aware of actix? What do you think of it?
- youeseh 8y agoI'm not aware, to be honest. I'm only now learning Elixir for a few weeks now and plan on taking up Rust next after building a small Elixir project. What I found was: - Elixir, has awesome support for concurrency and zero-downtime deployments. Runs on Erlang VM. Inspired by Ruby. - Rust - replacement C/C++ as the low-level programming language of the future for people who want to write pretty code.
- adamnemecek 8y ago> has awesome support for concurrency so does rust. > Rust - replacement C/C++ as the low-level programming language of the future for people who want to write pretty code. It's not just that, it also replaces say python or ruby on the serverside. > write pretty code. Yeah, no, it's for people who want to be productive in a low level language.
- dnautics 8y agoThe erlang vm is explicitly designed for concurrency. I wrote the raft protocol in elixir in about 300 lines of code. Rust is great, but it's pretty hard to argue that any language has more awesome support for concurrency than the beam languages.
- adamnemecek 8y agoOk let's talk concrete implementation. Rust: https://github.com/pingcap/raft-rs https://github.com/pingcap/raft-rs LOC: 15417 Erlang: https://github.com/rabbitmq/ra https://github.com/rabbitmq/ra LOC: 18012 Lines of code is not the only metric. I'm actually really curious about Erlang and Elixir but to be honest I do like type systems a lot. I also like the idea of idk...having one language for my os, db, front-end.