Live data from Hacker News

Rocket – Simple, Fast, Type-Safe Web Framework for Rust

rocket.rs

31–40 of 49 posts

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#31
post #15

I'm using Rocket for a small production application for my PhD project. One supervisor recently took over the project and asked me where he could connect a log stream to detect crashes. I said: "I don't know. I never have crashes". At the same time, maximum memory consumption is about 15 MB (3% of 512 MB) and CPU load 0.1% on a Starter instance on Render. So credits to the Rocket maintainers for making Rocket such a…

do you think it would be hard to transition to Rust and use Rocket?

I mostly just python and kotlin as my languages

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#32

What got me interested in Rocket was from this talk (a great talk btw): https://youtu.be/lBQHrj6vwAo?feature=shared&t=1934 (A Case for Oxidation) The main selling point for me was that Rocket made security threats (XSS, SQL injection etc) impossible by guarantees which was a bit mind blowing imo. It is a bit like database guarantees which is insanely useful as an application grows. Is this still the case with Rocket…

> I mean, Rust is fast and secure and makes my software "unhackable" for the price of a bit slower development? Seems like an obvious choice then.

Something being written in Rust doesn't mean it's unhackable. It lowers the likelihood of memory safety errors to the point of them being negligible, and a lot libraries will have APIs that encourage correct usage by default. But your application can still have a bug, and that big can still be exploitable. For example, if you're making a file transfer application where the sender has control over the path to be written, and you don't make an explicit check for path traversal on the receiver, a malicious sender can overwrite any file the receiver process has write access to in the entire filesystem. Rust didn't protect you there from an exploitable bug. You could make an API where that won't happen unless you opt into arbitrary path traversal, but that is not what most libraries, including std, do.

I don't say this to mean "Rust bad", but rather "don't be mislead by imprecise language about what Rust gives you". You can write bugs in any language. The extent of the blast radius is different per language.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#33
> While Rocket is still in the 0.x phase, the version number is purely a stylistic choice.

> If you're coming from a different ecosystem, you should feel comfortable considering Rocket's v0.x as someone else's vx.0.

I didn't think there were libraries in the Rust world that objected semver. It seemed quite ubiquitous since it's built into Cargo. Very disappointing.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#34
post #17
post #16

Earlier quoted context omitted.

>Middleware ("fairings" in rocket parlance) I really hate it when libraries introduce their own nomenclature for the sake of being cutesy.

And ironically its not even a great word to describe what its use is

But honestly, “middleware”? That was already taken years ago, long before the web took off. In fact, it was first used before the web was even invented!

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#35
I know they recently released 0.5 which finally works with stable Rust, among other things, but it really is "too little, too late" for me, as I've since moved onto first Actix Web then onto Axum. There is something to be said for rapid development rather than waiting to release big releases every other year. This is similar to the discussion of Elm a few days ago, where I left it because we needed critical bugs to be fixed and features to be added, so we migrated to a framework that does have such a rapid development cycle.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#37
post #15

I'm using Rocket for a small production application for my PhD project. One supervisor recently took over the project and asked me where he could connect a log stream to detect crashes. I said: "I don't know. I never have crashes". At the same time, maximum memory consumption is about 15 MB (3% of 512 MB) and CPU load 0.1% on a Starter instance on Render. So credits to the Rocket maintainers for making Rocket such a…

do you think it would be hard to transition to Rust and use Rocket? I mostly just python and kotlin as my languages

In my experience, the more programming languages and frameworks you know, the easier it is to learn a new one. So it depends on how much you know already and how much you want to learn.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#38
post #15

I'm using Rocket for a small production application for my PhD project. One supervisor recently took over the project and asked me where he could connect a log stream to detect crashes. I said: "I don't know. I never have crashes". At the same time, maximum memory consumption is about 15 MB (3% of 512 MB) and CPU load 0.1% on a Starter instance on Render. So credits to the Rocket maintainers for making Rocket such a…

do you think it would be hard to transition to Rust and use Rocket? I mostly just python and kotlin as my languages

Learning Rust can be challenging, especially if you're accustomed to Python or Kotlin. The Rust compiler is strict, which can be demanding for programmers. However, the effort can be rewarding due to Rust's advantages. Expect a slower pace of progress, as tasks that are straightforward in Python or Kotlin may require more time in Rust. The difficulty level is higher, but with motivation, it's certainly achievable.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#39
post #18

Earlier quoted context omitted.

What term are you referring to? Also, speed and performance aren’t the only reasons to use Rust. Rust also helps ensure correctness in significant ways, and make stable applications.

rocket and flight terms. mount? is it a horse? launch? well, it's a rocket. fairings? good thing they don't introduce cable installation. i'd rather use haskellin instead of rust if we're talking about "correctness" and "stability", whatever those are.

Then why not use Haskell?

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#40
post #9

From a quick glance it seems still vulnerable to trivial slowloris’ing D: Is anybody actually exposing their rust-based websites to the internet? I want to, but it seems that for some reason every rust web framework keeps TCP connections open _forever_, meaning that even with file descriptors bumped to 64000, my web server runs out of FDs and needs to be killed and restarted every 3 hours or so. The standard advice s…

How do you handle https if you don't? Do you use certs directly in code? Also, do you use LetsEncrypt or do you actually pay for certs? I have been developing websites all my grown life and I always put them behind a reverse-proxy. That has never been the culprit of any slowdowns in my experience and nginx is very, very fast and supports everything you may want to have. I usually nowadays reach for caddy just because…

> How do you handle https if you don't?

All of the code is here: https://github.com/shish/shm-cached/blob/main/src/tcp.rs

Two async functions - one listens on port 80, and forwards requests into the business logic; one listens on port 443 (grabbing a certificate from Let’s Encrypt if it doesn’t have an up-to-date one in the cache), decrypts the SSL, and forwards requests into the business logic.

Before I gave up and wrote my own software I tried various combinations of nginx, varnish, hitch, haproxy, squid, traefik, and I’m sure more that I’m forgetting. Most of them worked ok in most cases (and I’m still happily using `varnish -> nginx -> app server` for other parts of the site) -- but for one reason or another they each had issues handling tens of thousands of requests per second on a tiny potato of a server D: (If any of them worked then yes I would go ahead and use them - but it wouldn’t stop me feeling bad about needing to have a whole extra reverse-proxy layer just because my web framework doesn’t know how to close idle TCP connections :P)

(Incidentally if somebody knows of a CDN or cloud service that’ll serve ~3Gbps of NSFW content for <$800/mo, I would be more than happy to quit writing my own software to run on hand-managed bare-metal servers :P)

Post reply on HN