News for hackers. Stuff that matters.
Re:Actix – Actor Framework for Rust by jamil7 on Thursday February 13, 2020 @05:07AM (#22316570)
Whats the state of Rust if I wanted to get into it for backend development? I've looked briefly into Rocket and liked it but didn't delve too deep, I understand Actix is one of the most mature?
Re:Actix – Actor Framework for Rust by _-___________-_ on Thursday February 13, 2020 @05:35AM (#22316676)
I wouldn't call Actix the most mature, but it's definitely the one that gets talked about the most.

I built a fairly complex backend directly on top of Hyper[0] (it doesn't even involve that much glue, really) in 2016 and have updated it as Rust and Hyper have matured. It's actually a delight to work on, and I brought a new hire on board recently who had no trouble getting up to speed, since everything is just straightforward, idiomatic Rust.

I've looked at basically every Rust "web framework" that's been released since 2016, and I can't see any of them simplifying the codebase enough to justify using them. Quite a few of these frameworks result in code that isn't obvious to a Rust programmer who hasn't used that framework before, too, which I consider a disadvantage (I prefer obvious over clever).

[0] edited to add for those that may not be aware: Hyper is a client & server HTTP library. Many/most of the frameworks are built on top of it.

Re:Actix – Actor Framework for Rust by codetrotter on Thursday February 13, 2020 @06:29AM (#22316886)
Yeah I agree with this. I am working on an API backend in Rust too, and I originally started out writing it using actix-web.

After the concerns about the massive use of unsafe in actix-web in the past I grew a bit concerned and already made me think about going away from using actix-web.

When I started looking at upgrading to actix-web 2.0 there was a lot of rework needed to be done, but very lacking documentation.

I also reached out and got some help from the maintainer of actix-web a few times prior to that but he was always really really brief and for me personally it was difficult to make sense of. Of course I understand that he can’t spend his time helping everyone as that would take up all his time. But from purely a developer point of view, the docs were too lacking for me, and everything felt quite convoluted to try and make sense of.

I was left feeling frustrated because actix-web was so hyped and seemingly popular but for me it was difficult to work with.

I switched to hyper and so far am happy with my decision. I am not going to touch actix-web again anytime soon, but that is only my personal opinion and feeling.

Re:Actix – Actor Framework for Rust by mamcx on Thursday February 13, 2020 @08:42AM (#22317633)
> I wouldn't call Actix the most mature

Surely? I try several other for replace my .NET core project, and Actix is the only one that barely get there.

Which other handle without much fuzz:

- Auth (big!) - Routing with state and db pooling - Forms - Templates - Encode/Decode all stuff (query string, headers, etc) - Allow to inject middle-wares - Have (at least) the bare minimum of functionality like gzip encoding - And many other small details I forget now

I have worked, alot, with django, then use .net core and now Actix, and the others rust frameworks are lacking badly as far I see.

What I see the rust ecosystem is lacking now is mostly around templating (need more love for dynamic options!) and some stabilization around rdbms usage..

Re:Actix – Actor Framework for Rust by _-___________-_ on Friday February 14, 2020 @12:22AM (#22324152)
Actix has a lot of features, but to me that's not the same as maturity. I don't want one "batteries-included" framework, I want components (preferably mature and relatively boring) with well-defined interfaces that I can use together to build my backend.
Re:Actix – Actor Framework for Rust by mamcx on Friday February 14, 2020 @12:45PM (#22328456)
Thats is fine, but is surprising how many stuff you need to make a semi-complex site. Is better for a ecosystem to have the "batteries-included" framework that cover the needs of many and then specialize.

Django, ROR pull a lot of people into.

Re:Actix – Actor Framework for Rust by ay on Thursday February 13, 2020 @06:47AM (#22316984)
I ended up building my own l framework for my use case (about 30KLOC NMS, all Rust) - http://github.com/ayourtch/rsp10 - would be interesting to hear your critique if you have a minute to look at it!
Re:Actix – Actor Framework for Rust by DarthGhandi on Thursday February 13, 2020 @06:28AM (#22316882)
Actix smashes a lot of benchmarks. For the regular dev/company in production use have no idea why people would use it.

Hyper seems the sane option for most trying to simply build a backend.

It's really good to see others building on it though. Won't deny how clunky it once was before async got stabilized.

Re:Actix – Actor Framework for Rust by _-___________-_ on Thursday February 13, 2020 @06:35AM (#22316908)
You have to adjust the filters, because hyper isn't considered a "framework", but the TechEmpower benchmarks show hyper beating even actix (though it's narrow).

Definitely agree things were pretty clunky for async Rust web stuff before async/await!

Re:Actix – Actor Framework for Rust by DarthGhandi on Thursday February 13, 2020 @06:56AM (#22317033)
The sugar is real nice with async/await, plus some performance improvements. I got all excited upon release and moved my backend over to async, do somewhat regret not waiting 6 months.

Docs are sparse, this is across all the various crates needed, a bunch of required interoperable parts all needing specific alpha versions or separate preview crates.

Can't deny it's not user friendly right now. Very much early days.

Regardless, a lot of effort was put into the design and have to respect core devs for that. Think it was the most discussed/debated feature ever.

Re:Actix – Actor Framework for Rust by Dowwie on Thursday February 13, 2020 @07:00AM (#22317057)
Async-await is a game changer for all async rust development. Futures combinators became a sunk cost. Good riddance.
Re:Actix – Actor Framework for Rust by s_c_r on Thursday February 13, 2020 @07:44AM (#22317268)
That's good to know! I got burned pretty bad trying to switch away from actix-web to one of the other frameworks (rocket, gotham, warp) after the whole kerfuffle and lost my taste for Rust as a backend web language as a result. Seeing your experience makes me want to try again with only hyper! I've always heard it was too "low level" and never gave it a proper look as a result.
Re:Actix – Actor Framework for Rust by Qwuke on Thursday February 13, 2020 @06:29AM (#22316885)
I've used Rocket and Actix for production web services. I love Rocket's conciseness; however, it still has a nightly dependency, and is still in the process of updating to async. If you can live without those two things, I'd highly recommend rocket.

Actix is one of the most mature but (in my opinion) complicated for someone to stand up when just standing up a simple web service. It's extremely performant though.

I'd look into tower and warp too if I were you - they seem to be almost as concise as Rocket, but have no nightly dependencies and already have async support.

Re:Actix – Actor Framework for Rust by skohan on Thursday February 13, 2020 @06:54AM (#22317019)
FWIF I have played a bit with Actix for a few small projects, and it wasn't for me. It's a very "battery's included" library which does a lot of things for you, like transforming data structures into responses automagically. It feels a bit like rails where you just have to know the magic words sometimes to make things happen, and it's not exactly clear how things work.
Re:Actix – Actor Framework for Rust by Qwuke on Thursday February 13, 2020 @07:10AM (#22317098)
I think that's a great description! Every 'batteries included' Rust web framework I've used so far makes the same boilerplate/magic trade off as Rails, though some magic has felt more intuitive than others.

Hyper doesn't remove much boilerplate but it's one of the most intuitive options that I've seen.

Re:Actix – Actor Framework for Rust by hd4 on Thursday February 13, 2020 @05:11AM (#22316587)
Re:Actix – Actor Framework for Rust by dakom on Thursday February 13, 2020 @09:35AM (#22317990)
I'm looking at warp[0] and like the concept behind it very much... a bit higher level than hyper, but using a concept of composable filters without being too opinionated. Haven't done much kicking of the tires yet though

[0] https://github.com/seanmonstar/warp

Re:Actix – Actor Framework for Rust by dragonsh on Thursday February 13, 2020 @05:41AM (#22316697)
At present Rust's primary focus is systems programming language, it will take another 3-5 years to be a viable web programming that too in a niche area. I doubt the libraries will be mature enough to provide easy way to build the way other languages do.

If you know Ruby or Python or C# or Swift or Go language or Dart or TypeScript or JavaScript don't change to Rust yet. It's far far away from having similar library, documentation and developer eco-system.

I believe Haskell has more mature web development eco-system than Rust at present, but they also suffer from same issue most libraries do not have enough documentation and it's tiring to go through the library code to understand how to use it. But if you want to do Rust, why not try Haskell, you will learn much more and it offers a new way of functional programming. Indeed Rust, Swift, C++, Java, Python, Ruby, JavaScript etc. all borrowed ideas from Haskell or OCaml. Indeed Rust was initially written in OCaml

Actix which is the most popular framework in Rust just had a core developer who left it and was dead for a while before community tried to revive it. [1] [2]

[1] https://words.steveklabnik.com/a-sad-day-for-rust

[2] https://github.com/actix/actix-web/issues/1289

Re:Actix – Actor Framework for Rust by EugeneOZ on Thursday February 13, 2020 @06:53AM (#22317018)
Oops, I'm writing web backends in Rust 5 years already and didn't know it's not "viable" yet.
Re:Actix – Actor Framework for Rust by Thaxll on Thursday February 13, 2020 @08:35AM (#22317583)
Afaik there is no mature swagger version for Rust which is a no go if you do a lot of API services.
Re:Actix – Actor Framework for Rust by dragonsh on Thursday February 13, 2020 @07:07AM (#22317085)
Yes probably viable for you as an individual, this does not collate into viable for most. It’s still a niche inside a niche.

People are writing web backend in Haskell for decades, it is a viable choice for very specific niche of web development. Rust has miles to go before it can reach even that stage. At present elixir has much bigger eco-system than Rust.

Re:Actix – Actor Framework for Rust by Qwuke on Thursday February 13, 2020 @07:15AM (#22317118)
I don't think the 'Rust is not as far along as backend web Haskell' is true in my (minimal) experience.

I've worked at one very small company and one very large company, and at both Rust was a much more serious/common consideration for web services than Haskell.

Re:Actix – Actor Framework for Rust by DeedsMoraine on Thursday February 13, 2020 @08:06AM (#22317390)
I doubt that has much to do about the merits of either language as a web back-end, and it's more about people not wanting to consider Haskell at all.
Re:Actix – Actor Framework for Rust by Qwuke on Thursday February 13, 2020 @08:16AM (#22317442)
I absolutely agree - there's a lot of explaining when you have to choose the less traveled path, and it hurts there's a perception that both languages are intended for 'academic' or 'niche' purposes.

Why Rust is considered over Haskell in one of the organizations I've been with is because it has the performance/memory usage characteristics of C/C++, which is a requirement for certain services. Though for many projects I'd imagine they'd meet similar levels of resistance.

Re:Actix – Actor Framework for Rust by sdegutis on Thursday February 13, 2020 @04:08PM (#22321442)
I think the fact that Haskell is more math than programming might also be related to that. I've been programming for a decade and still don't understand Haskell.
Re:Actix – Actor Framework for Rust by imtringued on Thursday February 13, 2020 @08:20AM (#22317466)
I disagree. The ecosystem needed for web development doesn't need to be large. One major framework with a lot of integration focused plugins (think SSO, LDAP, SQL, Kafka, etc) should be more than enough. In the JVM ecosystem Micronaut isn't even two years old and it is already a viable choice for a lot of use cases.
Re:Actix – Actor Framework for Rust by devmunchies on Thursday February 13, 2020 @12:29PM (#22319542)
Event Crystal, which isn't even 1.0 yet, is easier to build a web server. The rust team just hasn't focussed on web programming as much as systems programming.

Its even the main example on Crystal's homepage: https://crystal-lang.org

Re:Actix – Actor Framework for Rust by EugeneOZ on Thursday February 13, 2020 @08:03AM (#22317372)
You have no experience and arguing with someone who has experience. Very impressive.
Re:Actix – Actor Framework for Rust by pjmlp on Thursday February 13, 2020 @06:51AM (#22317003)
Still quite immature versus what you can get in Java, .NET, Go and Erlang.

Actix is probably the closest to it, but then there are the message bus, database bindings, monitoring, orchestration, ... to look for.

Re:Actix – Actor Framework for Rust by tlamponi on Thursday February 13, 2020 @08:07AM (#22317395)
We do a new project in rust. It has a REST API building upon tokio and hyper, effectively the whole backend is in rust.

Building upon hyper isn't to bad, but not the "plug and play" way, I'd guess. For us it's OK, as we have a lot of control over the design and the stuff on top isn't to much.

Things are fast, code is OK once you wrangled about it with the compiler, async support is already OK (but definitively needs to improve, especially in the compiler for diagnostics and errors).

Re:Actix – Actor Framework for Rust by qaq on Thursday February 13, 2020 @06:14AM (#22316833)
It's definitely workable but async/await landed relatively recently most key libs have been updated but things can be rough on documentation side of things.
Re:Actix – Actor Framework for Rust by zelly on Thursday February 13, 2020 @05:49AM (#22316728)
I think if you want to do web dev backend with Rust (or C++ or any bare metal lang), you should do it behind a RPC framework (Thrift, gRPC) if only for security purposes. But it's also way more convenient. There's no need to have your core business logic also become entangled with a web server unless the networking minutiae is relevant. There are too many things that could go wrong on a public-facing endpoint to trust the runtime of something you are essentially rolling on your own if you use Rust, C++, C, etc.