Earlier quoted context omitted.
Fun experiment, try and benchmark a simple file download on a simple web server using rocket.rs (which also uses tokio and hyper, and has a built in fileserver type, so just a few lines of code) and compare it to a vanilla nginx config. Here’s the rocket.rs source I used: #[rocket::main] async fn main() -> Result { rocket::build() .mount("/", rocket::fs::FileServer::from("/tmp/test")) .ignite() .await? .launch() .awa…
Enabling lto, using codegen-units=1, and using the minimum required feature flags might improve performance a bit.
Ferron – A fast, memory-safe web server written in Rust
91–100 of 102 posts
Re: Ferron – A fast, memory-safe web server written in Rust
#92Earlier quoted context omitted.
This doesn't count because hyper doesn't support sendfile. Maybe hyper would outperform nginx in other scenarios.
Disabling sendfile in nginx makes it take 170ms instead of 150ms on my system. Because nginx knows to tune the buffer sizes properly, which goes a long way. Using strace reveals what’s happening, rocket is reading and writing to file descriptors 4 kilobytes at a time, using 2 syscalls every chunk. nginx uses far, far fewer of them. (And with sendfile enabled, only one for the whole download.) Also, there’s no reason…
Interesting. Do you know which algorithm nginx uses to determine the proper buffer size?
Re: Ferron – A fast, memory-safe web server written in Rust
#93Re: Ferron – A fast, memory-safe web server written in Rust
#94Re: Ferron – A fast, memory-safe web server written in Rust
#95Earlier quoted context omitted.
no it doesn't
It absolute does. What do you think Arc/Rc are?
Re: Ferron – A fast, memory-safe web server written in Rust
#96Random thing I’ve been wondering: is there a point in including TLS support in web servers any more? Isn’t it always better to run a reverse proxy and terminate HTTPs at the edge?
Re: Ferron – A fast, memory-safe web server written in Rust
#97Earlier quoted context omitted.
It absolute does. What do you think Arc/Rc are?
(Atomic) Reference Counted structs. They count their own references, there is no external mechanism tracking all of the reference counts at runtime. Modern rust does not include a garbage collector. You might be confusing a garbage collector with the general concept of memory management, which is a feature of (AFAIK) every high level language. Many C projects also have reference counted structs, but a reference count…
https://en.wikipedia.org/wiki/Garbage_collection_(computer_s...
Re: Ferron – A fast, memory-safe web server written in Rust
#98Earlier quoted context omitted.
By the name i'd say Arc is reference counting, which isn't exactly garbage collection...
Reference counting is quite literally a subset of garbage collection.
Re: Ferron – A fast, memory-safe web server written in Rust
#99Earlier quoted context omitted.
Reference counting is quite literally a subset of garbage collection.
Garbage Collector acts mainly in unpredictable way. I mean it is possible it won't free memory even if counter is zero already. This is not true if we are talking about Rust.
Re: Ferron – A fast, memory-safe web server written in Rust
#100Earlier quoted context omitted.
Offering more detailed timeouts for other stages of the request would be great, too. For example with HAProxy you can configure separate timeouts for just about everything. The time a request is queued (if you exceed the max connections), the time for the connection to establish, the time for the request to be recived, inactivity timeout for the client or server, inactivity timeout for websocket connections... The li…
I also implemented timeouts for response processing (including reading the request body from the client), to protect against Slow HTTP POST attacks.