Live data from Hacker News

Actix: a small, pragmatic, and fast Rust web framework

actix.rs

71–80 of 125 posts

Re: Actix: a small, pragmatic, and fast Rust web framework

#71
post #69

This looks really nice! I learned Scala primarily to use the Play Framework which is a fabulous way to build large web applications. This looks spiritually quite similar, but with the advantages of Rust.

Funny, I'm learning Scala for work after teaching myself Rust. It's definitely made the whole process a lot more straightforward thanks to the commonalities between them.

Re: Actix: a small, pragmatic, and fast Rust web framework

#72

I evaluated a few different Rust web frameworks, where performance was the deciding factor. A minimum viable echo server was put through its paces with `h2load` on a relatively recent MacBook Pro. `actix-web` was literally 100x faster than the next fastest competing framework. The benchmark result really confused me. But you'll find that the `actix` actors are extraordinarily lightweight and highly optimized around t…

Have you tried to create a more complex web page and have the web frameworks render that as well? Sometimes being the fastest at the most trivial request isn't enough, if it can't handle complex request fast as well.

Also, do you have a list of speeds for the frameworks you've tested?

Re: Actix: a small, pragmatic, and fast Rust web framework

#73
post #37

I have just started playing with Actix-web. Rust-Noob as well. The yellow world example compiled to a binary that was ~ 5 MB. As a general case, Actix-web pulls in a lot of dependencies at install, and compile time.Are all of those dependencies really necessary for a hello world scenario? Being a Rust newbie, I thought maybe I was using the wrong tool and started to look at hyper instead..

5MB is nothing compared to what you'd use for a similar project in node or Python or Ruby. Sure, it's not the tiniest it could be, but using tools like strip, not including debug symbols etc it gets pretty damn small. Honestly though, at that point I think size becomes entirely pointless to even mention unless you need to run it in a super constrained environment, which you're probably not when you're using the stand…

There's a lot that can be done to shrink a Rust binary[0]. A copy of the summary:

- Compile with --release.

- Before distribution, enable LTO and strip the binary.

- If your program is not memory-intensive, use the system allocator (assuming nightly).

- You may be able to use the optimization level s/z in the future as well.

- I didn’t mention this because it doesn’t improve such a small program, but you can also try UPX and other executable compressors if you are working with a much larger application.

[0]https://lifthrasiir.github.io/rustlog/why-is-a-rust-executab...

Re: Actix: a small, pragmatic, and fast Rust web framework

#74
post #30

Earlier quoted context omitted.

To supplement the other sibling question that I answered: It's a learning experience. Right now, I can't port everything to Rust, because each platform has its advantages. Rust is still missing a lot of libs that exist in NPM and Maven, so it makes it difficult. I've been exploring exposing some functions that exist in Java/Kotlin through gRPC (as everything runs on the same network anyways) until it's available on R…

Could you link to your blog, please? I'd like to read about that when you do end up writing about the experience.

I assume its [0] as can be found in his profile. Too bad it is throwing an error right now.

[0] http://nevi.me

Re: Actix: a small, pragmatic, and fast Rust web framework

#75
post #72

I evaluated a few different Rust web frameworks, where performance was the deciding factor. A minimum viable echo server was put through its paces with `h2load` on a relatively recent MacBook Pro. `actix-web` was literally 100x faster than the next fastest competing framework. The benchmark result really confused me. But you'll find that the `actix` actors are extraordinarily lightweight and highly optimized around t…

Have you tried to create a more complex web page and have the web frameworks render that as well? Sometimes being the fastest at the most trivial request isn't enough, if it can't handle complex request fast as well. Also, do you have a list of speeds for the frameworks you've tested?

A lot of Rust frameworks use sync io. The first generation does because the libraries for async didn't exist yet, and Rocket doesn't because (last I heard), the author said that he didn't feel the ergonomics were there yet, and that's one of Rocket's primary goals. So that leaves Actix, Gotham, and Shio, basically. Gotham hasn't been tuned for performance at all. I haven't seen any Shio benchmarks.

There are a lot though: https://github.com/flosse/rust-web-framework-comparison#serv...

Re: Actix: a small, pragmatic, and fast Rust web framework

#76
post #73
post #37

Earlier quoted context omitted.

5MB is nothing compared to what you'd use for a similar project in node or Python or Ruby. Sure, it's not the tiniest it could be, but using tools like strip, not including debug symbols etc it gets pretty damn small. Honestly though, at that point I think size becomes entirely pointless to even mention unless you need to run it in a super constrained environment, which you're probably not when you're using the stand…

There's a lot that can be done to shrink a Rust binary[0]. A copy of the summary: - Compile with --release. - Before distribution, enable LTO and strip the binary. - If your program is not memory-intensive, use the system allocator (assuming nightly). - You may be able to use the optimization level s/z in the future as well. - I didn’t mention this because it doesn’t improve such a small program, but you can also try…

s/z was made stable ten days ago: https://github.com/rust-lang/rust/pull/50265

So, two releases :)

Re: Actix: a small, pragmatic, and fast Rust web framework

#77
post #69

This looks really nice! I learned Scala primarily to use the Play Framework which is a fabulous way to build large web applications. This looks spiritually quite similar, but with the advantages of Rust.

I started using Scala for Play and Akka and I'm currently using Akka[1] in production in many projects.

[1]: http://akka.io/ Akka is the implementation of the Actor Model on the JVM.

Re: Actix: a small, pragmatic, and fast Rust web framework

#78
Not sure if I'm missing something, but for the Techempower Bencharks [1] I had the impression that the bottleneck for other rust libraries were in accessing the database rather than handling http requests. However, looking at the code [2] it seems that the Actix solution isn't doing anything special with regards to this. Can someone give a quick description of "what" is causing such a huge performance boost for Actix compared to other frameworks?

(I might add that this is a question I've had for a while, and I did not check the source at [2] in detail today.)

[1]: https://www.techempower.com/benchmarks/

[2]: https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...

Re: Actix: a small, pragmatic, and fast Rust web framework

#79

Earlier quoted context omitted.

Yes, I'm not constrained in any way to not be able to run a 5 MB binary. I was curious if that was an indication of what is to come for large projects... I guess I was tangentially pointing to complexity and abstraction there.

rust doesn't use dynamic linking, which contributes a lot to that size.

Wont a crate compiled with 'crate_type = "dylib"' be dynamically linked if you specify '-C prefer-dynamic' when compiling your program?

https://doc.rust-lang.org/reference/linkage.html

Re: Actix: a small, pragmatic, and fast Rust web framework

#80

Earlier quoted context omitted.

Could you link to your blog, please? I'd like to read about that when you do end up writing about the experience.

I assume its [0] as can be found in his profile. Too bad it is throwing an error right now. [0] http://nevi.me

It is, I didn't see that it's down. Just finished writing my last exam, so I'll have time to get it back up and running
Post reply on HN