Live data from Hacker News

Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

rocket.rs

31–40 of 75 posts

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#31
post #30

I was just recently looking at the state of web frameworks[1] in Rust, and it seems like the two most popular are this and Iron[2]. Can anyone comment on some of the differences between the two? Also, can anyone point out a few sites that were made using these frameworks? [1] http://www.arewewebyet.org/ [2] https://github.com/iron/iron

arewewebyet hasn't been updated since March, and there's been some big developments since then.

Those probably are the two most popular, but there's a Cambrian Explosion going on right now, with new frameworks like Susanoo and Cargonauts appearing on the regular. Heck, I even have my own little half-baked one.

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#32
post #30

I was just recently looking at the state of web frameworks[1] in Rust, and it seems like the two most popular are this and Iron[2]. Can anyone comment on some of the differences between the two? Also, can anyone point out a few sites that were made using these frameworks? [1] http://www.arewewebyet.org/ [2] https://github.com/iron/iron

This list has been updated more recently: https://github.com/flosse/rust-web-framework-comparison

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#34
post #30

I was just recently looking at the state of web frameworks[1] in Rust, and it seems like the two most popular are this and Iron[2]. Can anyone comment on some of the differences between the two? Also, can anyone point out a few sites that were made using these frameworks? [1] http://www.arewewebyet.org/ [2] https://github.com/iron/iron

Iron provides a bare minimum of concepts that you need. Rocket comes with its opinions and a lot of features nicely integrated. Iron will allow you to design anything you want easily, because all elements are as simple as they possibly can be and compose nicely, but requires that you have your own vision and enough experience to know what you need and how to build it. So Iron is great if you need thin layer of web interface added to some existing non-web project, or have enough experience with web and Rust to have own vision. It also work fine with stable. Rocket is great for all other cases - if you are new to webdevelopment and/or Rust, expect framework to tell you how to do things and don't mind using unstable. I don't have examples of sites, but none of those frameworks deals with UI, so I am not sure how would that help you.

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#35
How is the performance of Rocket?

So far all the Rust web frameworks I've seen have pretty disappointing performances.

I was expecting C++/Java/Go level of performance. Instead, Tokio & Iron turn out to be slower than many frameworks in Ruby, Python, PHP, JS:

https://www.techempower.com/benchmarks/#section=data-r14&hw=...

https://www.techempower.com/benchmarks/#section=data-r14&hw=...

https://www.techempower.com/benchmarks/#section=data-r14&hw=...

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#36

How is the performance of Rocket? So far all the Rust web frameworks I've seen have pretty disappointing performances. I was expecting C++/Java/Go level of performance. Instead, Tokio & Iron turn out to be slower than many frameworks in Ruby, Python, PHP, JS: https://www.techempower.com/benchmarks/#section=data-r14&hw=... https://www.techempower.com/benchmarks/#section=data-r14&hw=... https://www.techempower.com/benc…

* iron isn't using async io which is very important for Techempower

* Tokio-minihttp is #4 overall on the plaintext benchmark there, which is sort of the "what is the max performance" benchmark

I don't know of anyone who is really actively looking at Techempower and optimizing based on it, which is how you win benchmarks.

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#37

I don't have any experience in Rust. From what I read, Rust is a low level / system programming language. Comparing to dynamic languages like Python, I understand that Rust is much faster. However, Python is fast enough for most web applications. So why should I use Rust in web development? Even if the library ecosystem were mature enough, could I expect my productivity could become nearly high as in Python?

In terms of ecosystem maturity Rust is far behind Python, but ignoring that and performance, it still has some merits:

- static analysis helps you avoid numerous issues that plague Python. Runtime errors are far less likely and you are forced to greater discipline when coding

- it is modern language. After using algebraic data types, pattern matching and traits it is hard to go back to old style OOP.

- You can extend existing types with your own traits, and so can library authors, so you have plenty of extremely useful extensions. Just add use clause referencing some library, and everything gets more useful methods, without any magic or monkeypatching, so it causes no issues as it could in some dynamic languages.

I'd say it is massive gain in terms of quality and maintainability, but at the cost of upfront investment. Rust isn't a language I'd expect people to write prototypes in, but with few crates it can be as expressive as Python in many cases.

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#38
I'm a Rocket fan and glad to see this big slate of improvements. On the other hand, I do want to register a bit of concern regarding the plan to add "first-class database support" for 0.4. I hope that doesn't result in a close coupling to any particular database, or to using a database in general.

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#39

I don't have any experience in Rust. From what I read, Rust is a low level / system programming language. Comparing to dynamic languages like Python, I understand that Rust is much faster. However, Python is fast enough for most web applications. So why should I use Rust in web development? Even if the library ecosystem were mature enough, could I expect my productivity could become nearly high as in Python?

Rust doesn't have a stable/mature HTTP implementation/abstraction yet.

Re: Rocket, Rust Web Framework, v0.3: Fairings, TLS, Private Cookies

#40
post #30

I was just recently looking at the state of web frameworks[1] in Rust, and it seems like the two most popular are this and Iron[2]. Can anyone comment on some of the differences between the two? Also, can anyone point out a few sites that were made using these frameworks? [1] http://www.arewewebyet.org/ [2] https://github.com/iron/iron

arewewebyet hasn't been updated since March, and there's been some big developments since then. Those probably are the two most popular, but there's a Cambrian Explosion going on right now, with new frameworks like Susanoo and Cargonauts appearing on the regular. Heck, I even have my own little half-baked one.

This is actually driving me a bit insane trying to do anything more than the simplest Rust samples. There are... a lot of competing libraries implementing the same concepts. Input validators, crypto, tls, http (there are I believe at least 3 http/2 implementations, and hyper doesn't even support it yet) and pretty much every concept under the sun (hell, hyper has its own implementation of a url type independent from servo_url).

There are several Json types across all the various crates, multiple Url types, multiple Http::Request or Hmac or SHA cipher types. They all use the same names but are always distinct constructs that cannot interop.

It might be one of the most significant ergonomic issues with Rust going forward. Having a dozen Url types in Python is fine since the typing usually just coerces them all to Strings for interop anyway. Most Url types are (thankfully) serializiable and have a to_string, but in a statically typed language the performance implications of having the compiler generate strings from objects to be consumed by another object's constructor are dreadful.

Post reply on HN