Actix (Rust) vs Zap (Zig) vs Zig: Performance (Latency - Throughput - Saturation - Availability)

  Рет қаралды 77,297

Anton Putra

Anton Putra

Күн бұрын

Пікірлер: 463
@AntonPutra
@AntonPutra 3 ай бұрын
🔴 To support my channel, I'd like to offer Mentorship/On-the-Job Support/Consulting (me@antonputra.com)
@adriandrozman3404
@adriandrozman3404 3 ай бұрын
node vs bun vs deno please
@XyndraNerd
@XyndraNerd 3 ай бұрын
kotlin native vs kotlin jvm vs go vs expressjs vs hono
@Dipj01
@Dipj01 3 ай бұрын
Express vs Laravel vs Django vs Fastapi vs Fastify
@abhaytiwari6401
@abhaytiwari6401 3 ай бұрын
c vs c++ vs rust vs go
@Cwyrm
@Cwyrm 3 ай бұрын
It would be cool to see what the Ntex framework (Rust) can do. It’s what the original creator of Actix moved-on to after giving Actix over to the community. It seems like it performs really well on the benchmarks I’ve seen it in, but it would be cool to see it in this format here against the other rust frameworks!
@BosonCollider
@BosonCollider 3 ай бұрын
Honestly the fact that you took feedback and went back to make further comparisons that incorporated the feedback from different communities may make it it one of the best videos of this kind around.
@AntonPutra
@AntonPutra 3 ай бұрын
thanks, i always read every single comment and improve with each new video and fix mistakes
@vercolit
@vercolit 3 ай бұрын
Thank you for correcting your mistake by rerunning the tests with optimisations! Mistakes are completely normal, but seeing corrections is surprisingly rare...
@ionutale1950
@ionutale1950 3 ай бұрын
yeahh, Anton is cool
@AntonPutra
@AntonPutra 3 ай бұрын
always!
@bogdanpanchuk296
@bogdanpanchuk296 9 күн бұрын
Schrodinger's Zig: 1. Advertises the speed and security of the language. 2. Requires disabling all runtime security checks to actually reach the advertised speed.
@AntonPutra
@AntonPutra 3 ай бұрын
Note on the previous benchmark: Zig was in 'debug' mode, which is the default, and I didn’t know that. I found a "production-ready" Dockerfile and thought it was properly compiled, so I’m not the only one who made that mistake.
@rasvatissi580
@rasvatissi580 3 ай бұрын
How fucking good that not even 1.0 zig took the C library and ran it like a fucking champ. Zig has great future ahead
@KushLemon
@KushLemon 3 ай бұрын
Hardly. It has no benefits over C.
@CoolestPossibleName
@CoolestPossibleName 3 ай бұрын
@@KushLemon You clearly haven't used zig enough
@RustIsWinning
@RustIsWinning 3 ай бұрын
Not sure if this is serious or bait lmao
@morjor-1
@morjor-1 3 ай бұрын
@@CoolestPossibleName there is some truth to that though. not that it doesn't have benefits over c, but i don't know if the benefits are strong enough for most companies to justify it over c. odin is kind of in that same place. in my opinion, c3 has more compelling arguments going for it.
@ulrich-tonmoy
@ulrich-tonmoy 3 ай бұрын
@@morjor-1 maybe start by just using zig as build system then add new feature on zig maybe
@bowildmusic
@bowildmusic 3 ай бұрын
FYI: Zap pre-allocates memory during startup, expecting higher loads… so memory tests don’t mean much.
@AntonPutra
@AntonPutra 3 ай бұрын
true
@StingSting844
@StingSting844 3 ай бұрын
Is that called arena allocation?
@Wayfarerer808
@Wayfarerer808 3 ай бұрын
@@StingSting844 that is correct
@atiedebee1020
@atiedebee1020 3 ай бұрын
​@@StingSting844no, its just preallocating so it doesnt need to do any malloc or systemcalls later
@_Aarius_
@_Aarius_ 3 ай бұрын
Its really cool to see this sort of "live"/iterative benchmarking developments with feedback. When you feel like it's all as good as it can get, I think it would be really cool to see a blog post with everything you learned, mistakes and all, all in one place!
@AntonPutra
@AntonPutra 3 ай бұрын
yes, I'll keep collecting PRs with optimizations and eventually release a video
@jm-alan
@jm-alan 3 ай бұрын
It's interesting that, from an ideological/approach perspective, it seems like toward the upper bound of performance limits, Actix is interested in conserving device resources, while Zap ensures nearly 0 request failures
@AntonPutra
@AntonPutra 3 ай бұрын
interesting
@jm-alan
@jm-alan 3 ай бұрын
@AntonPutra This is just an observation though; it could just be a design *_consequence_* , and not a decision lol
@dimitriv.3835
@dimitriv.3835 Ай бұрын
This guy efforts deserve like and subs, keep it up! 🤝
@AntonPutra
@AntonPutra Ай бұрын
thank you! ❤️
@AntonPutra
@AntonPutra 3 ай бұрын
I was thinking of running this benchmark on a standalone VM, and I even have everything ready, including the systemctl service files. However, the problem is that when you run something without limits, it starts to affect all other services on that VM. For example, I use node-exporter to collect basic metrics, so without limits, those exporters and agents begin to degrade as well, causing gaps in your monitoring system. You can set cgroup limits using systemctl, but it would be similar to how Kubernetes handles it.
@jiinyeongoh7458
@jiinyeongoh7458 3 ай бұрын
Hello Anton, I saw that a PR for setting the zap and zig stdlib implementation to 2 workers. Is that PR already included in this benchmark video? I really appreciate the effort you have put in these benchmark video. Thank you!
@AntonPutra
@AntonPutra 3 ай бұрын
@@jiinyeongoh7458 no actually i just cloned that lesson including this PR which uses only 1 worker and run with it - github.com/antonputra/tutorials/pull/271/files i got pr to increase the number of workers later.
@ionutale1950
@ionutale1950 3 ай бұрын
150k with 2 cores that is a lot! i did some similar tests, but on my local machine with NestJs and Go Fibber, not even close: - NestJs 400 req/s - Go Fibber around 10k dam, rust is fast. i am wondering if there is anything faster than Rust, like a server is C or C++
@OrtinFargo
@OrtinFargo 3 ай бұрын
I mean they would roughly be the same performance, since they are "manage your own memory" languages. what differs is the different HTTP framework implementation which actix seems to have the edge
@ionutale1950
@ionutale1950 3 ай бұрын
@@OrtinFargo zig sopposed to "roughly be the same" or even better, but is not. we should test and let the data decide
@rasvatissi580
@rasvatissi580 3 ай бұрын
Zig is something like 0.6 version lang m8. Id say that was pretty fucking impressive how zig ran that C library. Only small margin behind fully fledged rust. Id say that Zig will literally eat C
@ionutale1950
@ionutale1950 3 ай бұрын
@@rasvatissi580 i think you are right. zig is great
@stysner4580
@stysner4580 3 ай бұрын
400 oh my.
@Matty0187
@Matty0187 3 ай бұрын
What was the request output? Could you make it more "real world". Like an json response of 1kb, 10kb, 100kb. And then another test that compiles some zig to html or rust to html (using thr same 1kb, 10kb, and 100kb html outputs). Could you also add golang to these ?
@sighupcmd
@sighupcmd 3 ай бұрын
adding json parsing: that will additionally bench json parser lib performance, lowering the quality of "pure" stack bench
@AntonPutra
@AntonPutra 3 ай бұрын
interesting, I'll see what i can do to make it short
@Matty0187
@Matty0187 3 ай бұрын
@sighupcmd A proposal for a more practical benchmark: add two dimensions, JSON/API and HTML/Templating. This moves away from pure theory towards real-world use cases. Research into optimal engines for each will be needed, trading some purity for more relevant metrics.
@sighupcmd
@sighupcmd 3 ай бұрын
@@Matty0187 again, you propose to bench libs responsible for json/html (where are a dozens of them, btw). What's the point of this here? Here author used "minimal" required stack to make service respond. That's the correct way. Also, there's only one real use case: yours (your service's).
@Matty0187
@Matty0187 3 ай бұрын
@@sighupcmd errors, rps, and latency while great metrics, a response of "hello world" from a server is a naive. We should measure bytes or packets out as an additional dimension. I still wouls love to see how common template and JSON responses effect the rps, latency, and error rates cross the servers
@Galakyllz
@Galakyllz 3 ай бұрын
I really appreciate these videos. Thanks for putting in the effort to make them and thanks everyone who submits PRs.
@AntonPutra
@AntonPutra 3 ай бұрын
thank you!
@cruzfarfan1284
@cruzfarfan1284 3 ай бұрын
I'd like to see a comparison between the same web app on Rust Actix-Web and Elixir Phoenix. It might look like apples and oranges but it'll be interesting to see the memory utilization of the two apps. Elixir "processes" are light threads. Actix implements its own light threads but I understand those still use more memory than Elixir (BEAM) processes
@LtdJorge
@LtdJorge 3 ай бұрын
Actix-web stopped using the Actix actors, tho. And yes, Rust actors cannot be as efficient as BEAM actors, because BEAMs are preemptible (need assembly for that) and all state in BEAM is immutable.
@cruzfarfan1284
@cruzfarfan1284 3 ай бұрын
​@@LtdJorge Thank you. I wasn't aware of the Actix-web change. I still think the comparison would be interesting to see though. It'll put specific numbers to the memory usage
@AntonPutra
@AntonPutra 3 ай бұрын
ok noted!
@iulikdev
@iulikdev 3 ай бұрын
Rust proved it's top, i don't care about zig, elixir, go or anything else.
@AntonPutra
@AntonPutra 3 ай бұрын
@@iulikdev ok
@aquilafasciata5781
@aquilafasciata5781 3 ай бұрын
I would like to see this compiled with Zig safe considering that is the biggest selling point of rust is memory safety.
@vincentl7022
@vincentl7022 3 ай бұрын
Zig has only a safe mode to detect faults at runtime, in real word application you would release optimised for space or speed without the runtime failsafe
@AntonPutra
@AntonPutra 3 ай бұрын
well i did compiled zig in safe mode in the previous benchmark 😊
@dominikliberda4017
@dominikliberda4017 3 ай бұрын
Release Safe does not ensure (full) memory safety. It adds stuff like UB checks (some of it is missing in Rust), but no "full" memory safety like in rust.
@aquilafasciata5781
@aquilafasciata5781 3 ай бұрын
@@AntonPutra Ah, I see! Thanks for letting me know 😅
@xXxRaVeNcRoFt_LuVrr69
@xXxRaVeNcRoFt_LuVrr69 3 ай бұрын
Is it that relevant if your using actix which uses unsafe all over the place?
@bogdanpanchuk296
@bogdanpanchuk296 9 күн бұрын
Schrodinger's Zig: 1. Advertises the speed and security of the language. 2. Requires disabling all runtime security checks to actually reach the advertised speed.
@asezen77
@asezen77 3 ай бұрын
Would love to see more golang stuff! Thanks for all the content anyway :)
@AntonPutra
@AntonPutra 3 ай бұрын
thanks! django vs go next :)
@gneryze
@gneryze 3 ай бұрын
even after those optimization performance and compile command change, rust still on the top. its so satisfying how the developer and man behind rust and actix can achive such performance.... they are the GOAT
@u-k
@u-k 3 ай бұрын
fr
@Z3U5.0g
@Z3U5.0g 3 ай бұрын
Python/Nodejs for fast prototyping. Golang for production 98% of the time. Rust less than 2% of the time for certain super low latency requirements like HFT.
@NabekenProG87
@NabekenProG87 3 ай бұрын
@@Z3U5.0g Yep. Its cool that its so fast, but I would expect a systems language to have a worse DX than Go. But I think choosing feature complete framework in any language (e.g. Laravel) is also a very good solution. No "stack" hopping
@ionutale1950
@ionutale1950 3 ай бұрын
@@Z3U5.0g imagine Go with memory arenas (like zig) ❤
@elcalabeza7563
@elcalabeza7563 3 ай бұрын
@@NabekenProG87DX comes down to preference. I found golang panicked too easily and the error handling was pretty bad. Rust's pattern matching, union types (enums) and macros make it a joy to work with if you can push through the steep learning curve. But it comes down to preference in the end
@markchekhanovskiy3270
@markchekhanovskiy3270 3 ай бұрын
Thanks for running and sharing test results!
@AntonPutra
@AntonPutra 3 ай бұрын
my pleasure!
@snooks5607
@snooks5607 3 ай бұрын
thanks for nicely formatted and informative videos, subscribed
@AntonPutra
@AntonPutra 3 ай бұрын
thank you!
@AB2107.
@AB2107. 3 ай бұрын
Hi @AntonPutra I've been following your channel for a while now and I absolutely love your content on comparing tests and benchmarks of different programming languages and frameworks. I was wondering if you could consider doing a similar comparison between in-memory databases like Redis and RabbitMQ. I'm particularly interested in seeing how they perform under various workloads and use cases. Thanks for all the great content!
@AntonPutra
@AntonPutra 3 ай бұрын
Thank you! Actually, the second benchmark should have been Redis vs. Memcache, but every time I get distracted by reading all the comments. I'll get there eventually 😂
@damiankaczmarczyk9872
@damiankaczmarczyk9872 3 ай бұрын
100k req/s - like a few small towns clicking in app at the same time
@NabekenProG87
@NabekenProG87 3 ай бұрын
Me when I forget to turn off my autoclicker on that one shitty Browser game ... on 20 machines
@ionutale1950
@ionutale1950 3 ай бұрын
exacly, but with that load, you need like 16 vCPU for the database, and i may not be even close
@houstonbova3136
@houstonbova3136 3 ай бұрын
@@ionutale1950Depends wholly on the application. In-mem caching can help a lot with db hits. If you’re using a global state you can batch appends and read state once per server on ticks and it’d stay pretty light. If you’re displaying tables too big for cache for numerous reports and clients then yeah you’ll have some DB pains. But you likely wouldn’t get that kind of volume for that kind of thing.
@ionutale1950
@ionutale1950 3 ай бұрын
@@houstonbova3136 really? cache can do that? wow, this must be 2024, where cache is being used
@MuhammadIqbal-wt6pu
@MuhammadIqbal-wt6pu 3 ай бұрын
that's possible when it comes to a trading system.
@wahidfeb
@wahidfeb 3 ай бұрын
Nodejs vs php. I am interested in learning new insight on how to optimize both of them.
@Dipj01
@Dipj01 3 ай бұрын
Exactly. I have been requesting this too. But he seems too focused on Rust :(
@morjor-1
@morjor-1 3 ай бұрын
i imagine v8 would outperform php
@AntonPutra
@AntonPutra 3 ай бұрын
thank you! will do!
@iulikdev
@iulikdev 3 ай бұрын
Who use php in 2024?
@bigice7184
@bigice7184 3 ай бұрын
Some things are weird here. The availability drops of the rust app and the memory use of the native zig app.
@stysner4580
@stysner4580 3 ай бұрын
It's the difference between caching a lot and no caching at all. Caching means availability remains constant as long as you can keep caching requests at the cost of using more memory. Actix is almost completely functional; no caching.
@lolilollolilol7773
@lolilollolilol7773 3 ай бұрын
The native Zig app is 1Mb which isn't much different from the Rust app.
@AntonPutra
@AntonPutra 3 ай бұрын
correct
@SeySvK
@SeySvK 3 ай бұрын
love this series Anton!
@AntonPutra
@AntonPutra 3 ай бұрын
thank you!
@titfortat4405
@titfortat4405 3 ай бұрын
Rust can actually be FASTER than Zig, C or C++ in some cases because their ownership and aliasing rules for &T and &mut T allow for more aggressive optimization techniques. Although the downside to Rust lifetimes is that it restricts which programs the compiler will mark as semantically correct, that is also one of its benefits. Since Rust programs are restricted to a smaller subset, the compiler can also make more aggressive assumptions/optimizations of those valid programs.
@dark0sv
@dark0sv 3 ай бұрын
Unfortunately there are a lot of cases where the assembly generated by LLVM is suboptimal, like additional memory/register copies. It would be very interesting to see a Rust compiler that is built from the ground up to take advantages of all available guarantees.
@stysner4580
@stysner4580 3 ай бұрын
I think the most optimizations come from iterators in this case. There probably is a whole lot of bounds and null checking in the C/Zig libs.
@ulrich-tonmoy
@ulrich-tonmoy 3 ай бұрын
@@dark0sv i think zig has a plan to remove dependency from llvm
@michaelutech4786
@michaelutech4786 3 ай бұрын
You are talking about avoiding unnecessary copy operations? Does Rust actually have an advantage over Zig here? Zig does seem to do rather aggressive optimizations in this department already. Since Zig is going to have its own backend, it might be able to benefit more from Zig specific optimizations in the future. For the time being, most effort in Zig seems to go into optimizing the compiler performance (incremental compilation, etc.). I'm curious to see what happens when the focus shifts to code generation and optimization later on.
@stysner4580
@stysner4580 3 ай бұрын
​@@michaelutech4786 If Zig uses pointers, it should be the exact same. I suspect iterators are the main reason why. The Zig/C implementation probably does bounds and null checks every iteration of a loop. Rust's iterators don't have to.
@errores-me6yu
@errores-me6yu 3 ай бұрын
пожалуйста сравни go с node js, gin/fiber vs nest.js/next.js + простые запросы к бд, может пулл соединений, очень интересно!
@AntonPutra
@AntonPutra 3 ай бұрын
horosho, obyazatelno sdelau! zapisal
@JonathanZigler
@JonathanZigler 3 ай бұрын
Interesting memory vs cpu trade-off. Depending on throughput it could mean that the zig implementation would be better suited for embedded devices.
@AntonPutra
@AntonPutra 3 ай бұрын
i have a new pr with zig optimization, i'll test it soon - github.com/antonputra/tutorials/pull/280
@JetzigWebFramework
@JetzigWebFramework 13 күн бұрын
Nice to see Zig web dev getting some attention :)
@Jonathanlouisa
@Jonathanlouisa 3 ай бұрын
Hi love your videos. Can you do some more main stream comparison like php/laravel or JS/Node vs Rust/Actix vs Go/Fiber, as most of the web is php. Can we can see how big the performance difference is?
@AntonPutra
@AntonPutra 3 ай бұрын
yes about to start in a day or two
@paulabrudan7896
@paulabrudan7896 Ай бұрын
Can you try axum/ntex in rust with sailfish and postgres? It should be faster than actix, checkout the techempower benchmarks repos
@AntonPutra
@AntonPutra Ай бұрын
yes, i was thinking of refreshing it and including ntex soon
@UwU-f2a
@UwU-f2a Ай бұрын
​@@AntonPutragrab the code from techempower benchmark, so you got the code from the framework team
@apinanyogaratnam
@apinanyogaratnam Ай бұрын
I don’t understand why availability is not 100% always, why does the request fail instead of waiting until it can complete the request? Specifically asking for rust
@AntonPutra
@AntonPutra Ай бұрын
some requests take longer than the client timeout resulting in 408
@redhawk3385
@redhawk3385 3 ай бұрын
You also have to remember that Rust has hardened a lot of small optimization into std and some core libraries, this test would be more fair result in 10 years to give Zig more time to mature. But I'm team rust, even if it's slower I'll have less bugs with the safety features.
@AntonPutra
@AntonPutra 3 ай бұрын
Sure, I'm mostly testing frameworks, so as they mature, I'll rerun my tests again.
@kuhluhOG
@kuhluhOG 3 ай бұрын
​@@AntonPutrayeah, I guess a yearly checkup would be great
@j-p-d-e-v
@j-p-d-e-v 3 ай бұрын
As usual great content :)
@AntonPutra
@AntonPutra 3 ай бұрын
thank you!
@Michael-wr7gi
@Michael-wr7gi 2 ай бұрын
Why would you set autoscaling threshold at 50% CPU usage?
@PhosphorusMoscu-code
@PhosphorusMoscu-code 3 ай бұрын
Could you do a comparative with Actix and Spring or some Java framework?
@AntonPutra
@AntonPutra 3 ай бұрын
ok noted!
@torcher5023
@torcher5023 3 ай бұрын
Arguing who's linux syscall wrapper is faster is kinda funny thing to see.
@MichScarn73857
@MichScarn73857 3 ай бұрын
Amazing. 🎉
@AntonPutra
@AntonPutra 3 ай бұрын
thanks!
@soixantelly
@soixantelly 3 ай бұрын
the pure zig implementation is another league on memory usage, it's heavily optimized to avoid heap allocations as much as possible at the expense of using the heap for parallelism with that memory usage it can scale an order of magnitude better than both zap and actix actix is an overall winner here, it has a mature and more featured api, memory usage & req/s better than zap zap is little immature as a project, it will benefit from both code optimization & from zig future versions
@AntonPutra
@AntonPutra 3 ай бұрын
thanks for the feedback
@Takatou__Yogiri
@Takatou__Yogiri 15 күн бұрын
Same can happen with actix web😑
@christiangualteros36
@christiangualteros36 3 ай бұрын
Thank you. Great job
@AntonPutra
@AntonPutra 3 ай бұрын
thank you!
@fredrikhult2950
@fredrikhult2950 3 ай бұрын
I love these followups!
@AntonPutra
@AntonPutra 3 ай бұрын
thanks i do my best
@czlowiek48881
@czlowiek48881 3 ай бұрын
I would love to see a odin language. I'm just learning it and I know it's made primarly for games and simulations, however I would love to see how it could perform for a game server applications. I write much less code when I use odin comparing to javascript or C++ (I use the same C library in all cases - raylib), I would like to try it as a game server but I'm not sure about what performance I can expect. I really like this video, great point of view on those languages.
@AntonPutra
@AntonPutra 3 ай бұрын
thanks will try! someone already suggested odin in the past
@czlowiek48881
@czlowiek48881 2 ай бұрын
@@AntonPutra Hey, you may also want to try elixir. For me it's basically like a cloud built in a language, elixir is created for doing hyper scale applications. I never tried it and comparing it seems quiet hard, since you would need to compare not only language performance but also database, queue and other features. Me personally I would compare it with aws alternatives. Btw, would you like to share when you would like to create a performance test for odin? I can't wait to see it :D
@AntonPutra
@AntonPutra 3 ай бұрын
Previous Benchmark - kzbin.info/www/bejne/jKm6YZygjaaZhdU
@Dipj01
@Dipj01 3 ай бұрын
Do a laravel vs express vs django benchmark. Battle of the interpreted
@sub-harmonik
@sub-harmonik 3 ай бұрын
really you're comparing the libraries used rather than the languages themselves. Hypothetically every compiled language would be compiled to the same most-efficient machine code with safety checks where necessary.
@AntonPutra
@AntonPutra 3 ай бұрын
yes, i'm mostly focused on frameworks and libraries used in everyday development
@matthiasberndt7720
@matthiasberndt7720 3 ай бұрын
Would you consider sharing the source code of the benchmarking client? At least I did not find after a short search in your repositories.
@AntonPutra
@AntonPutra 3 ай бұрын
well this is the old one in Go - github.com/antonputra/tutorials/tree/main/lessons/201/client but i just rewrote it in rust and probablly will release it soon
@RiwenX
@RiwenX 3 ай бұрын
⬇ Team Rust button
@AntonPutra
@AntonPutra 3 ай бұрын
🤣
@stormsilva2079
@stormsilva2079 3 ай бұрын
⬇️ Team Rust Sub-Button
@almuhajer6760
@almuhajer6760 3 ай бұрын
Common W for Rust
@alHailHale
@alHailHale 3 ай бұрын
Hell Yeah
@GoodWill-s8j
@GoodWill-s8j 3 ай бұрын
Team rust bottom
@hiddenni
@hiddenni 3 ай бұрын
can you do a actix vs django rest?
@AntonPutra
@AntonPutra 3 ай бұрын
django is next
@kossboss
@kossboss 3 ай бұрын
How do you time-lapse thru the results so it looks like they are going really fast? At first I thought it was real time and then I realized you are replaying them somehow on grafana
@AntonPutra
@AntonPutra 3 ай бұрын
oh just using editing software to speed up
@christerpherhunter930
@christerpherhunter930 3 ай бұрын
I'm a rust developer and all of my applications are written in Rust using Actix-web. These results are so stress relieving to see. Thank you.
@AntonPutra
@AntonPutra 3 ай бұрын
My pleasure, but I have yet to test Ntex. They say it's the best :)
@antoningavrel2808
@antoningavrel2808 3 ай бұрын
Could you add axum in the benchmark? Would make a lot of sense to compare it to actix.
@AntonPutra
@AntonPutra 3 ай бұрын
i'll make another one actix vs axum vs ntex
@adarshsingh764
@adarshsingh764 3 ай бұрын
Can you also do Python? would be cool to see how much slower it is as compared to these compiled languages
@AntonPutra
@AntonPutra 3 ай бұрын
yes django is next
@minciNashu
@minciNashu 3 ай бұрын
Can you expand on the 50% CPU usage autoscaling? I think it's an interesting detail.
@AntonPutra
@AntonPutra 3 ай бұрын
sure, here is an example - github.com/antonputra/tutorials/blob/main/lessons/181/1-hpa/cpu-memory/k8s/2-hpa.yaml#L20
@emilemil1
@emilemil1 3 ай бұрын
Interesting that rust seems to perform better but is a lot more unstable.
@AntonPutra
@AntonPutra 3 ай бұрын
i'll do some more tests including data pipelines in the near future
@mrpocock
@mrpocock 3 ай бұрын
Good to see Rust remains competitive. I wonder what causes rust to drop out on the latency test though. Sobering weird with an allocator?
@stysner4580
@stysner4580 3 ай бұрын
The memory usage gives it away. Actix is very functional. The processor overhead difference is due to caching.
@AntonPutra
@AntonPutra 3 ай бұрын
yes it's caching
@mrpocock
@mrpocock 3 ай бұрын
Looks like an opportunity for improvement!
@DevRJPro
@DevRJPro 3 ай бұрын
Thank you for this comparison, can you take into account the content of the queries? Actix sends more Data ( Http headers ) so you need Bytes/sec metrics. Also it would be really interesting to change Serde by Sonic-rs which is more performant, which will make Rust win even more points. And why not use Hyper directly instead of Actix? Thanks again 🙏🏻
@caiomestresmendes1868
@caiomestresmendes1868 3 ай бұрын
@@DevRJPro make the pr
@AntonPutra
@AntonPutra 3 ай бұрын
ok noted, yes it really sends more data and i actually have network usage metrics, i may show it next time
@grandlagging0zero175
@grandlagging0zero175 3 ай бұрын
а на русском такие же видео есть? у меня не работает на этом видосе яндекс перевод почему-то... :( кэш я чистил
@AntonPutra
@AntonPutra 3 ай бұрын
poka netu
@grandlagging0zero175
@grandlagging0zero175 3 ай бұрын
@@AntonPutra зря зря
@AntonPutra
@AntonPutra 3 ай бұрын
@@grandlagging0zero175 i'll get there :)
@charliegnu
@charliegnu 3 ай бұрын
A comparison of zap ReleaseSafe vs ReleaseFast would be interesting.
@AntonPutra
@AntonPutra 3 ай бұрын
maybe, thanks
@DanMackAlpha
@DanMackAlpha 3 ай бұрын
nice work
@AntonPutra
@AntonPutra 3 ай бұрын
thank you!
@kelvincesar_
@kelvincesar_ 3 ай бұрын
Really nice video! Could you please compare actix with ntex framework on rust?
@AntonPutra
@AntonPutra 3 ай бұрын
yes, soon! i was told ntex is the best
@kelvincesar_
@kelvincesar_ 3 ай бұрын
@@AntonPutra yeah, I read that it is from the creator of actix. Will be waiting!
@winnie8614
@winnie8614 3 ай бұрын
Does 100% CPU means 2 cores from your limit: 2 or it means 1 core ?
@AntonPutra
@AntonPutra 3 ай бұрын
Well, it's a little bit more complicated, then 100%. 1 CPU = 1000 millicores = 100% of a 100ms cgroup interval. So 2 CPUs = 200ms, or 100ms for each core. Here's the link for more details: kzbin.info/www/bejne/nmPTdKuglKuemsU.
@oscar_cyou
@oscar_cyou 3 ай бұрын
Spring boot with virtual threads please
@AntonPutra
@AntonPutra 3 ай бұрын
yes soon
@caiomestresmendes1868
@caiomestresmendes1868 3 ай бұрын
Rust is such a beast, will learn it asap for side projects kkkkk
@kai-.-man
@kai-.-man 3 ай бұрын
Try out Loco (based on rust) for a Ruby on Rails like setup that helps you get started, or Jeremy Chone on youtube with Rust 10x :)
@Cuca-hn3md
@Cuca-hn3md 3 ай бұрын
rust is a low level lang that doesn't feel low level at all, also it will not allow you to use pointers like crazy, and forces you to write everything thread safe, u can only make shitty code if u use "unsafe" keyword. also "thread_local" macro feels like magic, its wonderful.
@a0flj0
@a0flj0 3 ай бұрын
​@@Cuca-hn3md I wouldn't call Rust a low level language. It is a compiled language that allows you to write extremely efficient code and provides memory safety despite manual memory management. Those are indeed two highly desirable traits in system software, but that doesn't make Rust a low level language. Go, with its relatively low expressiveness, is a low level language - most of what you can write in other languages will take at least one and a half as many lines of code in Go. Rust, however, doesn't have this problem. With Rust, you can write a database driver or a Web application equally well, without writing much more code than if you'd use languages traditionally used for each job. In fact, if you compete against plain C in the database driver, chances are the Rust code will be smaller. I'd venture to say Rust be about on par with Python for the Web application.
@AntonPutra
@AntonPutra 3 ай бұрын
It's nice, but it's quite unique and takes time to learn
@stdprocedure
@stdprocedure 3 ай бұрын
​@@a0flj0 "level" could also mean how much control you have over what will actually happen in the computer. The fact that you can write inline assembly in Rust makes it IMO as low level as C.
@KangJangkrik
@KangJangkrik 3 ай бұрын
Dear Anton, please benchmark Rust vs C, thank you!
@AntonPutra
@AntonPutra 3 ай бұрын
i was thinking about it, but do you know any other C web framework besides facil.io?
@abhaytiwari6401
@abhaytiwari6401 3 ай бұрын
It's time for c vs c++ vs rust vs go
@justsomeguy8385
@justsomeguy8385 3 ай бұрын
Do people actually use C for web servers?
@abhaytiwari6401
@abhaytiwari6401 3 ай бұрын
@@justsomeguy8385 use case might be there for low latency applications not sure still would like to see a comparison if possible
@AntonPutra
@AntonPutra 3 ай бұрын
just couple more and i get to c++ i promise 😊
@AntonPutra
@AntonPutra 3 ай бұрын
well i may use facil.io directly in c without zig wrapper
@brdrnda3805
@brdrnda3805 3 ай бұрын
@@AntonPutra ... subscribed 🙂
@MrlegendOr
@MrlegendOr 3 ай бұрын
Go (Fiber) is it faster than Rust (Actix)?
@AntonPutra
@AntonPutra 3 ай бұрын
Possibly, I'll compare them soon.
@oliverfoxi
@oliverfoxi 2 ай бұрын
I wish you commented on all the graphs when you showed them
@AntonPutra
@AntonPutra 2 ай бұрын
noted
@kirillriman3611
@kirillriman3611 2 ай бұрын
i have no idea why it was recommended and why did i watched it but it was intresting
@AntonPutra
@AntonPutra 2 ай бұрын
thanks 😊
@davidlieber3494
@davidlieber3494 3 ай бұрын
Can you please make performance tests for kotlin vs other languages?
@AntonPutra
@AntonPutra 3 ай бұрын
sure, in the future!
@零云-u7e
@零云-u7e 3 ай бұрын
Zap is interop with Node to begin with. I use Zig for low level stuff, they dropped async out of stdlib as of 0.11.0. The fact Zap runs that well is still pretty amazing. The amount of code tweaking. I would expect Rust to handle volume, and even beat C if there were a framework. I'm suggesting allocation schemes a hot spot. On a smaller level, evaluate the defers. It would be an exquisite test. No js. Just system cranking. I like both languages, but I wouldn't think Zig would be ready for that. LLVM differences? Great test though. We're talking framework differences also. That's why I say isolate, and create a system grinder.
@AntonPutra
@AntonPutra 3 ай бұрын
thanks for the feedback, yesterday i got a new pr with optimizations so will test soon - github.com/antonputra/tutorials/pull/280
@rikschaaf
@rikschaaf 3 ай бұрын
Would be cool to see this in comparison to older languages like C(++) and java, that might not be using the newer techniques, but do have years of optimizations
@stysner4580
@stysner4580 3 ай бұрын
Honestly with how much more knowledge we have now, it would be very surprising if you can "optimize away" the difference. It will still be C at the top unless there is a paradigm shift (like the functional style of Actix).
@AntonPutra
@AntonPutra 3 ай бұрын
I'll try. Any language is only as good as the DevOps engineer running it in production😂
@nhwhn
@nhwhn 3 ай бұрын
AWESOME, i think axum would perform a little better here. And could you compare JAVA framework vs node ones?
@AntonPutra
@AntonPutra 3 ай бұрын
well based on the previous benchmark Axum is a bit slower, but i'll do java soon
@scarymonkey3496
@scarymonkey3496 3 ай бұрын
Would love to see these three against .NET, js and Java/kotlin.
@AntonPutra
@AntonPutra 3 ай бұрын
noted!
@axumanjack
@axumanjack 3 ай бұрын
Also i do want to see the Ntex vs Actix!!!!
@AntonPutra
@AntonPutra 3 ай бұрын
haha, ok soon!
@almuhajer6760
@almuhajer6760 3 ай бұрын
@@AntonPutra yes please!
@steveoc64
@steveoc64 3 ай бұрын
Probably a fair result then. The “std” zig implementation there is using only 1 thread, so 80k shows us where the hardware is getting saturated The flatline from there on is (likely) kubernetes throttling that maxed out single CPU Not surprisingly- all 3 implementations that are using the same llvm optimizer here perform very close up to that point. @anton - send me some links plz to how to duplicate your test setup so we can properly tune this for the environment it’s running on. Need to iterate the config to find a suitable balance here Fun project! Working with low level code (be it C / Rust / Zig whatever) is like tuning a car to match the course it’s racing on :) At least the audience is enjoying the show :)
@AntonPutra
@AntonPutra 3 ай бұрын
haha, sure I'm using EKS which is a managed Kubernetes cluster in AWS. If you have never used it before it can be problematic and expensive. You can use minikube locally but you would never be able to reproduce the benchmark locally. But at least you can test it and compare it. So minikube - minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Farm64%2Fstable%2Fbinary+download Kubernetes deployments - github.com/antonputra/tutorials/tree/main/lessons/208/deploy you can apply with kubectl apply -f ... also i have clients as well - github.com/antonputra/tutorials/tree/main/lessons/208/1-test also kubectl apply -f ... all images including clients are compiled for both arm and amd, so you can run them on mac as well if you need any help please let me know
@steveoc64
@steveoc64 3 ай бұрын
@@AntonPutra Cheers thanks. Yeah, I will go back and review some of your playlists, and try out those deploy scripts. Managed EKS is probs the way to go then. I dont mind spending a $bit to get it right .. just have to remember to turn it off when im done :) Interested in finding the code for your load-tester container - is that in a lesson somewhere ?
@AntonPutra
@AntonPutra 3 ай бұрын
@@steveoc64 i have older version written in go with prometheus metrics - github.com/antonputra/tutorials/tree/main/lessons/201/client but it is really outdated but can give you an idea. i recently rewrote that client in rust but it is not ready for release yet. with go client i used m7a.8xlarge instances with new rust client i only need 4xlarge
@AntonPutra
@AntonPutra 3 ай бұрын
@@steveoc64 Also, make sure when you run those tests in the cloud that your application and client are deployed in the same availability zone. AWS has data transfer charges between regions and between availability zones, but inside the same zone, it is free. If you start running load tests between zones, it could cost thousands of dollars in data transfer fees, so be careful.
@steveoc64
@steveoc64 3 ай бұрын
@@AntonPutra 208-tuning pr done :) Added a third zig implemention that uses another new network lib See what happens! Really appreciate the large scale test you are offering here - it’s a non trivial test, done right Kudos
@WiseWeeabo
@WiseWeeabo 3 ай бұрын
LOL, so the last benchmark was optimized rust vs zig with NO OPTIMIZATIONS? xDD
@AntonPutra
@AntonPutra 3 ай бұрын
yes, zig was in 'debug' mode, which is the default, and i didn’t know that. i found a production-ready dockerfile, and i thought it was properly compiled, so i'm not the only one who made that mistake.
@prakkumar3240
@prakkumar3240 17 күн бұрын
its will be better if you Actix Web(Rust) vs Drogon Framework(C++)vs zig , as these 3 are top on leaderboard
@Vedmalex
@Vedmalex 3 ай бұрын
Cool! may be you can examine the MOJO language?
@AntonPutra
@AntonPutra 3 ай бұрын
Interesting, I'll take a look. It's a very new language."
@gneryze
@gneryze 3 ай бұрын
Cool!!!! i will try it myself
@AntonPutra
@AntonPutra 3 ай бұрын
👍
@thanatosor
@thanatosor 3 ай бұрын
Actix / Rust still rock hard ! Zig / Stdlib seem to have great memory usage.
@AntonPutra
@AntonPutra 3 ай бұрын
it was optimized that way specifically for the test
@danimusbar
@danimusbar Ай бұрын
Please use Loco RS Framework for next Sir 😊
@half-duckprince3995
@half-duckprince3995 3 ай бұрын
maybe benchmark python vs go vs rust? To showcase the "tiers of performance"?
@AntonPutra
@AntonPutra 3 ай бұрын
yes in a couple of days
@yogeshdevaggarwal
@yogeshdevaggarwal 3 ай бұрын
Rust vs C++ is that one thing we all want from a very long time! 😄
@AntonPutra
@AntonPutra 3 ай бұрын
ok, i'll get there 😊 just a couple more js frameworks
@yogeshdevaggarwal
@yogeshdevaggarwal 3 ай бұрын
@@AntonPutra Thanks a lot buddy! You can also try Elysia vs Express on both Bun and Node. Nonetheless thanks for all the benchmarks 😄
@user-nx9vw1iw5w
@user-nx9vw1iw5w 3 ай бұрын
try Fast API vs node js Vs php laravel
@AntonPutra
@AntonPutra 3 ай бұрын
ok noted!
@timelimitexceeded0
@timelimitexceeded0 3 ай бұрын
do bun vs go comparison
@AntonPutra
@AntonPutra 3 ай бұрын
ok will do soon
@bilatungdulang9708
@bilatungdulang9708 3 ай бұрын
Next is nim vs c++
@AntonPutra
@AntonPutra 3 ай бұрын
noted!
@seanZG
@seanZG 3 ай бұрын
Can we please please please finally have Kotlin Ktor vs Java vs Dotnet
@AntonPutra
@AntonPutra 3 ай бұрын
ok soon!
@aryasenaputra-jb4vx
@aryasenaputra-jb4vx 3 ай бұрын
I like your video!! just wondering why your name is like indonesian name
@AntonPutra
@AntonPutra 3 ай бұрын
i like Bali, just changed it 🤣
@leulgirma
@leulgirma 3 ай бұрын
@@AntonPutra was there any improvement on C# , from the suggestions
@AntonPutra
@AntonPutra 3 ай бұрын
@@leulgirma yes i got a few PRs, i'll cover it in the near future
@aryasenaputra-jb4vx
@aryasenaputra-jb4vx 3 ай бұрын
@@AntonPutra whahaha mee too!
@cecepwandy9098
@cecepwandy9098 3 ай бұрын
php (laravel) vs other.. why.. because in my country .. we have cult that php is best web app ...
@AntonPutra
@AntonPutra 3 ай бұрын
haha, ok will do!
@exapsy
@exapsy 3 ай бұрын
Go vs NodeJS / NodeJS vs Rust!
@AntonPutra
@AntonPutra 3 ай бұрын
next, go vs node
@stysner4580
@stysner4580 3 ай бұрын
This just makes me more in awe of Actix.
@AntonPutra
@AntonPutra 3 ай бұрын
i was told that Ntex is even better
@almuhajer6760
@almuhajer6760 3 ай бұрын
@@AntonPutra Making an Ntex vs Actix video would be interesting
@AntonPutra
@AntonPutra 3 ай бұрын
@@almuhajer6760 will do, i'll add axum as well cause last time i didn't generate enough load
@gaurovsoni
@gaurovsoni 2 ай бұрын
nim vs rust please.
@AntonPutra
@AntonPutra 2 ай бұрын
noted!
@ConcerninglyWiseAlligator
@ConcerninglyWiseAlligator 3 ай бұрын
At least we all can agree in something, CPP sucks...
@ConcerninglyWiseAlligator
@ConcerninglyWiseAlligator 3 ай бұрын
@@AntonPutra C++
@AntonPutra
@AntonPutra 3 ай бұрын
haha thanks, long day :)
@RenderingUser
@RenderingUser 3 ай бұрын
Actix is wild
@AntonPutra
@AntonPutra 3 ай бұрын
it is :)
@weiSane
@weiSane 3 ай бұрын
Compare C++ too . I want to see something
@MuhammadIqbal-wt6pu
@MuhammadIqbal-wt6pu 3 ай бұрын
up
@AntonPutra
@AntonPutra 3 ай бұрын
soon!
@lraondua
@lraondua 3 ай бұрын
please do php swoole
@AntonPutra
@AntonPutra 3 ай бұрын
ok noted!
@kanji_nakamoto
@kanji_nakamoto 3 ай бұрын
Zig in debug mode is compared to Rust optimised. Embarrassing, delete the video. Run in Docker! What a troll.
@AntonPutra
@AntonPutra 3 ай бұрын
debug mode??? github.com/antonputra/tutorials/blob/main/lessons/208/zap-app/Dockerfile#L15
@rFliege
@rFliege 3 ай бұрын
Ничего себе акцентище. Даже без перевода все понятно )
@AntonPutra
@AntonPutra 3 ай бұрын
staraus :)
@oof-software
@oof-software 3 ай бұрын
I don't agree with the "only use Rust if you need the performance" since I prefer the DX of Rust over Golang. Once I was used to the ownership concept and wrote some async code, I don't feel like Rust is slowing me down at all. Although the problem that if one function becomes async and the async keyword has to propagate to all caller functions is pretty annoying. Learning Rust was probably easier for me since I come from a C/C++ background, I guess it's much harder to learn Rust if you only used garbage collected languages before.
@AntonPutra
@AntonPutra 3 ай бұрын
thanks for the feedback
@siya.abc123
@siya.abc123 3 ай бұрын
I need rust to fail
@AntonPutra
@AntonPutra 3 ай бұрын
sure, please send me PR
@fabiopetrillo
@fabiopetrillo 3 ай бұрын
Why?
@ulrich-tonmoy
@ulrich-tonmoy 3 ай бұрын
@@fabiopetrillo because some people liked to see the world burn (though i dont like rust but had to use on tauri applications)
@RustIsWinning
@RustIsWinning 3 ай бұрын
Keep dreaming. This won't happen! 🦀❤️
@ulrich-tonmoy
@ulrich-tonmoy 3 ай бұрын
@@RustIsWinning the higher you fly the harder you fall
@AmitGosain-i9w
@AmitGosain-i9w 2 ай бұрын
elixir vs Rust vs Lua vs Julia
zig will change programming forever
9:34
Low Level
Рет қаралды 367 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Rust vs Go: Performance Benchmark in Kubernetes #205
17:16
Anton Putra
Рет қаралды 173 М.
When Zig Outshines Rust | Prime Reacts
23:31
ThePrimeTime
Рет қаралды 146 М.
Nginx vs Caddy Performance
15:27
Anton Putra
Рет қаралды 33 М.
Deno vs. Node.js vs Bun: Performance Comparison
12:28
Anton Putra
Рет қаралды 79 М.
The SQLite Rewrite In Rust
22:15
ThePrimeTime
Рет қаралды 186 М.
Nginx vs Apache Performance
14:57
Anton Putra
Рет қаралды 40 М.
P99 CONF - Zig vs Rust
55:01
ThePrimeTime
Рет қаралды 84 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН