Hacker News new | ask | show | jobs
by rizzaxc 1572 days ago
Is it the time to consider Actix (or any other rust web framework) for production?

I'm planning for a rather ambitious project, but not sure if I should choose rust (the new shiny thing) or stick to good ol Go (while I do have some issues with it)

6 comments

Plenty of companies (including Microsoft IIRC) are using Actix in production. At this point it's not that shiny and new.

Actix is the most mature of the Rust web frameworks. Axum is new but very promising. Rocket is popular but development is stalled at the moment since the main developer has been going through some rough times.

Evidence that Microsoft use Actix? Im sure if they did you would have posted a link.
There wouldn't have been actix v1, actix-net or actix-web if it weren't for MSFT. They funded the work. They're may not use them anymore.
I remember reading somewhere that the original author was using it for some use cases at Azure, but I doubt it is anything public facing.
Rust is plenty ready for production. Choosing between Go and Rust for web backends is really choosing between a more complex language that allows you to have powerful abstractions and has a focus on correctness vs. A simpler language that is looser and prefers “verbose but simple” code.
Which of them is the more complex one?
From a language features perspective, Rust. Personally I find building up the rigor to do correct error handling in Go's approach or C libraries with seperate error functions is its own kind of complexity, however.
Google and most other software kings chooses C++ for backend. If you think you know better than them feel free to use the hype lang of the day. Rust will be gone in a few years.
I don't think that conflicts with my comment. Just because Rust is ready for production doesn't mean that C++ isn't also ready for production. For what it's worth, Google are increasingly choosing Rust for new projects. As are Microsoft, AWS and several other large software companies. Obviously it doesn't usually make sense to rewrite old projects that are already in C++.
We looked into Rust at our company (top 100) and it's clear it's not ready for production systems. It just puts developers into a huge tar pit fighting with the compiler for anything more than a simple hello world app. If it actually lived up to it's hype it would have been used to rewrite browsers, servers, OSes etc. But C/C++ are still the kings of system programming.
Off the top of my head…

Firecracker, the software AWS Lambda runs on, is written in Rust: https://github.com/firecracker-microvm/firecracker

Mozilla wrote Servo, a browser engine, in Rust. Part of it has been integrated into Firefox a while ago:

> Mozilla incorporated the Servo CSS Style engine in release 57 of its Firefox Quantum browser.

https://research.mozilla.org/servo-engines/

It’ll be used in Android: https://security.googleblog.com/2021/04/rust-in-android-plat...

It’ll probably find it’s way into the Linux kernel: https://news.ycombinator.com/item?id=29485465

The whole reason for Rust's existence was for Servo so using it as an example of its use is disingenuous at best.

Ok one bit of AWS runs on Rust.

C/C++ runs 99% of the the worlds software including OS's/browsers/GUI's/Compilers/Virtual machines/Games/Aircraft/Spacecraft etc etc etc.

"It'll be" same was said of Java

It is and will continued to be used in areas where security is important.

This is from November 2020, I’d expect them to use it even more by now:

> But we also use Rust to deliver services such as Amazon Simple Storage Service (Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), Amazon CloudFront, Amazon Route 53, and more. Recently we launched Bottlerocket, a Linux-based container operating system written in Rust. Our Amazon EC2 team uses Rust as the language of choice for new AWS Nitro System components, including sensitive applications such as Nitro Enclaves.

https://aws.amazon.com/blogs/opensource/why-aws-loves-rust-a...

> The whole reason for Rust's existence was for Servo so using it as an example of its use is disingenuous at best.

Mozilla wanted to push the boundaries of what's possible with a browser rendering engine and they felt like they couldn't do it safely with the existing languages, so they created their own. Doesn't that, alone, speak volumes for how useful Rust is?

> C/C++ runs 99% of the the worlds software including OS's/browsers/GUI's/Compilers/Virtual machines/Games/Aircraft/Spacecraft etc etc etc.

Now you're being disingenuous. Rust is still so young compared to those languages! Not to mention that the industries best served by Rust move glacially slowly compared to, say, the web. I bet we'll see significantly more adoption of Rust in 10-15 years.

While Rust is being used on the system level for Android, there are no plans for the time being, to ever support it for app development on the Android NDK or AGK.
Honestly it's pretty clear from your weirdly large number of negative comments on here that you've never taken a serious look at using the language for a real project. You just have some weird axe to grind with it.

That's cool, I guess, but also not particularly interesting.

My company currently runs Actix-web in production and is happy. Good tooling, fast, low resource costs, well-supported.
Anecdotal but my company is using it for a new project and we just hit production about a month ago. So far it's been great with 10+ million requests handled per day. Looking forward to upgrading to 4.0
I made another post in this thread, but I'm using it very happily for a few microservices that power https://fakeyou.com (one is the main web monolith, the other is a websocket to pubsub bridge for an upcoming feature).

- I've found it extremely fast to work with and iterate.

- I've been able to meld a lot of complex use cases to it. In-memory caches, worker thread pools, etc.

- It works great with testing, CORS, MySQL, Redis, forms, json, uploads, S3 clients, etc.

- Serde + the expressive type system is incredible (this is more about being able to use Rust, but Actix plays so well with it).

I'm using sqlx for nearly typified SQL checked at compile time. If we get a jOOQ-like DSL, I'll be overjoyed.

for request schema, do you know how rust/ actix supports protobuf? I find protobuf great for rapid prototyping, and using monorepo for both frontend + backend makes it even better for api consistency. my search shows there are 2 major libraries but the de factor parsing library doesn't support it (Serde)

also, I'm interested in how you structure your code. is everything a crate? or you work in a giant namespace with different structs (sorry if this doesn't make sense I don't know much rust)

No idea why you're downvoted/flagged, these are perfectly valid questions.

> for request schema, do you know how rust/ actix supports protobuf?

That's a great question! The serde annotations make it look like it should work. If not, there might be a plugin for it. Actix has a rather vibrant ecosystem of utility crates.

I've used Prost for protos once before (it felt like the more mature option), and the build integration was seamless. I was frustrated with how the IDE handled it at the time (Clion+Rust), which is one of the reasons I'm not using protos in Rust today. The IDE couldn't work out the types and everything touching the syntax tree near protos was opaque to the IDE. It was over two years ago the last time I checked the status of protos in Rust, so there's a good chance the situation has improved.

I didn't use Prost with Actix in particular, which is why I can't really provide insight there. It should be quick to set up a test.

I'm using two monorepos: one for frontend (yarn/typescript/react for three websites) and one for backend (all Rust; two servers and seven jobs). If I'd lumped it all together, I would have investigated protos more seriously. I should probably investigate using them again in the near future.

> also, I'm interested in how you structure your code. is everything a crate?

I'm using Rust workspaces to organize the backend monorep. I have about ten binaries, and five library crates that are shared between the various binaries. I also have a few vendored packages that aren't available on crates.io (newrelic-telemetry-sdk, etc.) I was told Bazel does a good job with build caching, so I'll investigate using that soon so I'm not always rebuilding the world.

> or you work in a giant namespace with different structs (sorry if this doesn't make sense I don't know much rust)

With the way modules work, there's next to no need for that in Rust. It's one of the most hygienic import systems I've used.

Overall, I'm extremely happy with the setup and it's been really productive for me.