Live data from Hacker News

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

rocket.rs

21–30 of 49 posts

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

#22
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…

These numbers are fine and all, but what really matters is how many requests per second it can do. Combined with response time across a timeline where you gradually increase the number of clients (fake or real).

To observe where your server experiences pain, and watching how it deals with it, and how/if it recovers is super useful. Benchmarking tools to pound your servers are plentyful, and these stats (connection/sec and avg response time) combined with the hardware spec is what makes a good praise or diss of a webserver performance.

Maybe you'll never intent do draw a huge load for real. I'm just saying its performance can be measured better than its cpu and ram usage while on low or no load. Even if that is a useful aspect in some sense.

Unless this is serverless of course. New ballgame entirely.

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

#23
post #5

introducing a new term when an established term exists seem to add another overhead. "but bro, you'll get used to it in no time." i hear you, buddy. it just leaves a bit bad taste. anyway, i can't believe i say this, i think dhh's words on tradeoff between squeezing performance out of an ecosystem and "just throw more hardware on it" is a tradeoff that i can clearly choose.

Every little speed bump that's thrown in your way has a real cost.

When those speed bumps are on the main path that you travel every single day, all those little sources of friction add up to a lot of drag. As an industry we've collectively established this nomenclature over the last 2-20+ years, and throwing it away so you can keep the cute rocket analogy reflects some really bad decisions being made.

Hey, at least everything isn't randomly named after Lord of the Rings characters though.

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

#25

Or, just use PHP… /s

I mean, you’re right if it’s something that they plan on maintaining for 10+ years and want to use a language specifically designed for the Web with a stable and mature ecosystem and plenty of developer support.

If it’s a small little hobby project then sure, use whatever little Web framework you want for Rust, Go, Zig, or whatever else the flavor of the day is.

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

#26
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…

Some of our infra at FastComments handles the SSL termination itself, it's really nice owning that in the app layer and removing another component. Yes, we use LetsEncrypt. Those are Java vertx apps. Good thing I didn't move them to rust I guess? But this seems like too weird of an issue to be true.

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

#29
Rocket is a delight. Been using it for a year now and the docs and dev experience and stability are all exceptional.

Request Guard Transparency[1] is something I’ve only seen in Rocket:

> When a request guard type can only be created through its FromRequest implementation, and the type is not Copy, the existence of a request guard value provides a type-level proof that the current request has been validated against an arbitrary policy. This provides powerful means of protecting your application against access-control violations by requiring data accessing methods to witness a proof of authorization via a request guard. We call the notion of using a request guard as a witness guard transparency.

Basically your endpoints can require access to a protected service via a parameter and you’re guaranteed that your code will only execute for valid&authorized requests. For example, imagine a UserService and a TeamAdminService, each with their own methods appropriate for their user type. Request guards are used to validate the request headers and database entries are correct before constructing these services. And since you can only construct them from a request, simply having a service listed as a parameter in your endpoint guarantees that the proper access control has be enforced before your code runs.

We’ve structured our app so that every sensitive operation goes through these services, thereby sidestepping entire classes of security concerns and missteps. I sleep better as a result and our security reviews are much more enjoyable.

I’d love to see this discussed more and adopted by more frameworks.

[1]: https://rocket.rs/v0.5/guide/requests/#guard-transparency

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

#30
post #19

After using Rocket in production for a year now. I'd really recommend Actix Web. Don't get me wrong, Rocket has some really nice features and good UI, but a couple things have proved to be real pain points: - Middleware ("fairings" in rocket parlance) can't respond to requests. This means your access control has to be replicated on every route as a guard. - Guards can result in errors (for example, if the request doe…

The first two points will be addressed in the next major release with typed catchers. The latest release notes[1] call this out, and in fact reference the same Github issue. Additionally, it looks like they're even addressing one of the most common criticisms - having to declare requirements/guards on every handler. See "Associated Resources". [1]: https://rocket.rs/v0.5/news/2023-11-17-version-0.5/

Really cool to see these issues are on the roadmap.

I remain skeptical on timeline for these but if the plans speed up dev time work out, then this is great news.

Post reply on HN