Quoting David Fifield (2022-02-28 03:58:38)
After about a day, the instance I restarted has caught up and is processing about as much traffic as the others.
- The Rust implementation of extor-static-cookie is a little bit more CPU-efficient, but only a little.
- The Rust implementation uses about 50% more memory, which is still negligible relative to other processes on the server.
I didn't run any controlled benchmarks, just watched the numbers in htop for a while. The three instances of Go implementation of extor-static-cookie hover between 10–12% CPU time and 30 MB of resident memory. The Rust implementation uses about 8–10% CPU time and 48 MB of resident memory.
That there's not a big different is not much of a surprise, given that both programs are essentially copy loops. I didn't post the results when I did it, but when I profiled the Go implementation 3 weeks ago, it spent most of its time in the splice system call, which "moves data between two file descriptors without copying between kernel address space and user address space."
My conclusion is that a Rust version of extor-static-cookie does not have a strong enough benefit to be worth spending much time on.
Nice experiment anyway, will be nice base to take ideas from if we get to write rust PTs in the future (wich might make sense to integrate them into arti).