#rustlang #springboot #java
Java (Spring Boot) API:
Rust (Warp) API:
========== Java (Spring Boot) Apache Bench ==========
Time taken for tests: 41.616 seconds
Requests per second: 12014.73 [#/sec] (mean)
Time per request: 83.231 [ms] (mean)
Transfer rate: 1205990.01 [Kbytes/sec] received
Percentage of the requests served within a certain time (ms)
50% 81
66% 82
75% 83
80% 84
90% 85
95% 87
98% 89
99% 94
100% 1155 (longest request)
========== Rust (Warp) Apache Bench ==========
Time taken for tests: 35.627 seconds
Requests per second: 14034.16 [#/sec] (mean)
Time per request: 71.255 [ms] (mean)
Transfer rate: 1395082.90 [Kbytes/sec] received
Percentage of the requests served within a certain time (ms)
50% 71
66% 73
75% 73
80% 74
90% 75
95% 76
98% 78
99% 80
100% 1090 (longest request)
========== Java (Spring Boot) Wrk ==========
Thread Stats Avg Stdev Max +/- Stdev
Latency 61.92ms 54.02ms 1.23s 88.27%
Req/Sec 2.93k 774.80 6.11k 78.34%
1040459 requests in 1.00m, 99.72GB read
Requests/sec: 17316.06
Transfer/sec: 1.66GB
========== Rust (Warp) Wrk ==========
Thread Stats Avg Stdev Max +/- Stdev
Latency 55.75ms 40.91ms 384.39ms 73.87%
Req/Sec 3.26k 198.22 4.02k 69.44%
1166137 requests in 1.00m, 110.55GB read
Requests/sec: 19403.64
Transfer/sec: 1.84GB
Quite impressive, if rust utilizes so much less memory that means we can have much more containers with less memory and serve much more applications in the same cluster. I'm looking for good alternatives for Java that could outperform using less resources, rust looks very promisse
Thankyou
People take note that Java might look almost as fast as rust now. But wait until the garbage collector kicks in.
I think the request per/s would drop significantly over long time. Because the GC needs to clean that memory.
I'm dotnet C# for almost 6 years, we would never load(1000) that much data/users in memory. I would load not more then 100.
It would be really interesting to see the memory usage if you load only 100 users in memory but then increase the request 10 times.
Hey friend thanks al to for making this video.. This is great, very helpful. Watched this just before starting my project. It seems I will use SpringBoot anyway because its not THAT bad. Its still good right.. Because to use Rust(Rocket) I will have to go through rocket again.. but anyway, thank you so much. Beautiful test you made there, I was looking to write something similar, I don't wanna steal the code for the test lol But I am gonna try to make something similar, is the benchmark written in shell ? Sorry I am very new to programming (9 months). I wanna recreate this test on my own. Thanks for the video again, great content !
Another, though far less relevant, metric is the deployed size (eg the size of the docher container).
I think you might be able to statically link the Rust implementation in its entirety, than you can deploy it with a scratch container.
I have seen at least one Rust Web-app do that, rustpad. They build it on rust:alpine and install musl-dev and sth else on the build layer.
Not sure what framework they use to deploy actually. If any.
EDIT:
Jup. He's using warp. And he's also adding openssl-dev. And packing it all into scratch.
Thanks you for these comparisons. I'm weighing up Rust web frameworks currently, so exactly what I need.
great series! can u also compare vert.x perf with rust as well?
Considering that Java and .net are constantly trying to outperform each other, it's no surprise that it would perform similarly or better than .net.
And just like .net… That ram usage is obscene!
Still, I wonder why Rust never utilises the full CPU capacity in these benchmarks? It feels like there is a lot more that Rust could do, but isn't doing.