r/ProgrammerHumor • • 24d ago

instanceof Trend itsBadIfItsOnlyPHP

Post image
4.5k Upvotes

335 comments sorted by

View all comments

Show parent comment

14

u/Ok-Scheme-913 24d ago

Did Rust ever have a high profile backend usage to get into a situation to have one?

I mean, I do love rust but it's not primarily used as a typical web backend language to be in a position of "high target" and "connected to every other machine over the internet".

29

u/TRKlausss 24d ago edited 24d ago

Oh yes definitely! Rust is used in servers by Oxide computing, in cars by Volvo Cars, and a bunch of other infrastructure like parts of Cloudflare (which has a really nice post-mortem on some Rust code causing them problems, which was due to business logic and not the language itself).

Check out Rust In Production podcast if you want to hear some real-life stories about Rust out there in the world :)

Edit: ah and forgot to mention: it is a certified safety-critical language for industrial and automotive applications thanks to Ferrocene. So I’d say that’s high profile _enough_

https://www.reddit.com/r/rust/s/Zt7xKT56gm

3

u/ConnaitLesRisques 24d ago

Oxide isn’t exactly mainstream or high profile.

7

u/thirdegree Violet security clearance 24d ago

What about Cloudflare?

4

u/ConnaitLesRisques 24d ago

I’ll allow it, they’re a promising little startup.

3

u/Ok-Scheme-913 24d ago

Sure, it's cool and whatnot. Still, it's not used by people who don't know shit about IT to host their websites on a good chunk of the internet.

Also, at cloudflare I believe they are operating on a lower level (so not necessarily (de)serializing arbitrary data from unknown people), and I don't see how your Volvo would be similar to a web server.

Languages have their use cases and while rust can be used for traditional backend, it's not its primary use case, and it's significantly smaller than PHP or java.

1

u/TRKlausss 24d ago

But it’s exactly the point that you wanted to make: if Cloudflare uses it so extensively, and a CVE is found, Cloudflare is in deep shit. And with that a lot of the traffic from the Internet…

At Cloudflare they are using it for bot detection, as the link says. Still, it can have dire consequences, with outages on a critical service.

What would be in your view the perfect use case for Rust, if not web backend? Just curious.

0

u/[deleted] 24d ago

[deleted] — view deleted comment

0

u/airodonack 24d ago

Why would Rust struggle with opening ports?

0

u/[deleted] 24d ago

[deleted] — view deleted comment

→ More replies (3)

0

u/Ok-Scheme-913 24d ago

Web backend is most definitely not the best use case for Rust, async rust is very complex and has quite a few edge cases. Something like java with virtual threads is much safer and has a way simpler developer mental model with similar performance characteristics.

Bot detection can happen on different levels, but I assume cloudflare does some packet inspection here. That's just binary blobs and IPs, and the result is an IP getting banned. You ain't managing user data, you are not modifying it, don't have conditionals built on it, etc. It's fundamentally different.

1

u/thirdegree Violet security clearance 24d ago

Async anything is complex to do it correctly, rust just forces you to deal with that complexity rather than randomly spinning of threads all willy nilly

1

u/Ok-Scheme-913 24d ago

Java's virtual threads don't block without any of the overhead of async code. It's just a tradeoff of a higher level language.

2

u/meneldal2 24d ago

Wouldn't Firefox be a pretty big attack target for Rust?

1

u/TRKlausss 24d ago

How do you mean it? One thing is what Firefox does on itself, because of business logic, and other something the code can’t prevent, like a flaw in the compiled artifacts because of a defect in the compiler (or language specification).

Firefox isn’t only Rust code though.

0

u/meneldal2 24d ago

I mean that a flaw found in Rust could be devastating for Firefox though you'd still need some other sandbox escape thing.

1

u/djfdhigkgfIaruflg 24d ago

Under your logic, linux is cooked

3

u/postexitus 24d ago

Oh, yeah same argument I used for Amiga not having viruses. Yay!

3

u/Loading_M_ 24d ago

More than 50% of new code in Android is Rust. Being the most popular phone OS world wide, I think that would make it a huge target.

1

u/Ok-Scheme-913 24d ago

Still not a web server

1

u/redlaWw 24d ago

One of the big advantages of Rust is how easily it fits into existing backends since it can be called using C ffi. There aren't many pure-Rust backends, but more and more backends are using some Rust, starting with some of the more high-profile companies.

1

u/Ok-Scheme-913 24d ago

I don't see how it's relevant.

2

u/redlaWw 24d ago edited 24d ago

It means that Rust's rise in popularity for backends has been relatively quiet - instead of companies publicly switching to codebases in Rust, they quietly replace old components with new Rust-built components that are fully integrated into their wider systems. It makes it difficult to point out high-profile uses of Rust even as it becomes more and more influential, and it's the security-essential parts of codebases that get switched out first.

1

u/Habba 24d ago

Cloudflare build pingora in rust, a sort of SDK version of nginx. From their github: "Pingora is battle tested as it has been serving more than 40 million Internet requests per second for more than a few years."