Rust vs Go: Performance (Latency - Throughput - Saturation - Availability)

  Рет қаралды 37,607

Anton Putra

Anton Putra

Күн бұрын

Пікірлер: 305
@AntonPutra
@AntonPutra 2 ай бұрын
► What should I test next? ► AWS is expensive - Infra Support Fund: buymeacoffee.com/antonputra ► Benchmarks: kzbin.info/aero/PLiMWaCMwGJXmcDLvMQeORJ-j_jayKaLVn&si=p-UOaVM_6_SFx52H
@qizhang5749
@qizhang5749 2 ай бұрын
Elixir vs Go
@AntonPutra
@AntonPutra 2 ай бұрын
@@qizhang5749 in the pipeline!
@Autystyczny
@Autystyczny 2 ай бұрын
C# vs Java - this will be interesting. Please have in mind that C# can be compiled as a fully native app (via AOT) and PGO mode can be set to full. It would be interesting to see how much of a difference it can do.
@AntonPutra
@AntonPutra 2 ай бұрын
@@Autystyczny noted!
@hichambout6731
@hichambout6731 2 ай бұрын
This vid is 🔥🔥! Thank you , You're the GOAT! 😎💯 Just subbed and can't wait for more! 🙌
@slcooIj
@slcooIj 2 ай бұрын
Great work (as always), Anton. Your visual explanations are top notch.
@AntonPutra
@AntonPutra 2 ай бұрын
thank you!
@TweakMDS
@TweakMDS 2 ай бұрын
This video is just a goldmine of information, I love that you added some solid background, which - to be honest - could have been a separate video
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! :)
@Lewboskii
@Lewboskii 2 ай бұрын
finally some good non micro benchmarks that test realistic use of the languages. elixir vs go would be interesting to see
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! will do elixir as well soon
@tmaffia
@tmaffia 2 ай бұрын
This is great insight... CPU usage remains low but end users are seeing massive spikes in latency. I know in the past i've made the mistake of viewing low resources usage equating to faster processing or higher throughput. In reality its just one piece of the puzzle. Great video
@InternetEntreprenuer
@InternetEntreprenuer 2 ай бұрын
Amazing work on this video. This is super useful data and answers a lot of questions I've had about rust performance and I commend you even if this video doesnt get millions and millions of views.
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! actually i got a lot of tips how to improve the Rust code, i'll retest and release results in a few days
@buildingblockdev
@buildingblockdev 2 ай бұрын
@@AntonPutra I'm looking forward to this
@ionutale1950
@ionutale1950 2 ай бұрын
this is a great performance test. well done
@AntonPutra
@AntonPutra 2 ай бұрын
thank you!
@Bleibruk
@Bleibruk 2 ай бұрын
Wow! I loved this video! Thanks! I started to love histogram data for horizontal scaling...
@AntonPutra
@AntonPutra 2 ай бұрын
thanks!
@JaiminBrahmbhatt
@JaiminBrahmbhatt 2 ай бұрын
Love the comparison great to see this. Amazing work.
@AntonPutra
@AntonPutra 2 ай бұрын
thank you!
@ulvigulu
@ulvigulu 2 ай бұрын
Thanks for the great content! I noticed around 1:38 that the calculation for availability was mentioned as the ratio of failed requests to total requests. I believe it should actually be the ratio of successful requests to total requests (availability = successful requests / total requests). Just thought I'd share this in case it helps clarify things for others. Keep up the great work!
@AntonPutra
@AntonPutra 2 ай бұрын
thanks for the feedback, actually i have correct query i just misspoke. In the query i use status!~"[4-5].*" to filter out failed requests
@ManuelMartinez-nl5cy
@ManuelMartinez-nl5cy 2 ай бұрын
PLEASE Go need to rest for the next battle 😂. Great work 🎉
@AntonPutra
@AntonPutra 2 ай бұрын
haha
@valentineejk
@valentineejk 2 ай бұрын
😄
@ibrahimshehuibrahim918
@ibrahimshehuibrahim918 2 ай бұрын
🤣🤣🤣
@yolodii
@yolodii 2 ай бұрын
No No please 😂 This is helping ALOT Please keep it up Anton
@ziad_m_404
@ziad_m_404 2 ай бұрын
Can I suggest a short video showing how you created those custom dashboards in grafana 👀?!
@AntonPutra
@AntonPutra 2 ай бұрын
i have a few pls take a look: - github.com/antonputra/tutorials/tree/main/lessons/130 - github.com/antonputra/tutorials/tree/main/lessons/134 - github.com/antonputra/tutorials/tree/main/lessons/135 - github.com/antonputra/tutorials/tree/main/lessons/136 - github.com/antonputra/tutorials/tree/main/lessons/137 - github.com/antonputra/tutorials/tree/main/lessons/137 - github.com/antonputra/tutorials/tree/main/lessons/140
@ziad_m_404
@ziad_m_404 2 ай бұрын
@@AntonPutra Thank you for your efforts and time ^^.
@ZergStylexDD
@ZergStylexDD 2 ай бұрын
@@AntonPutra Hi! Does it possible to get metrics by path from nginx ingress controller? Can't find any video on this on your channel. I found only setup with fluentd that transform nginx logs to prometheus metrics. Is there any easier way to achieve that? I'm using AWS EKS with kube-prometheus-operator and wanna see nginx metrics on different path of my app like /api/some_method
@ZergStylexDD
@ZergStylexDD 2 ай бұрын
I spent some time on Google, and as I understood it, this is only achievable if we specify many different paths in the Ingress K8S resource. In this case, we will see these paths in our metric. But we always need to update this configuration whenever we add a new endpoint to our application...
@Chris-rm1pn
@Chris-rm1pn 2 ай бұрын
Now we need comparison with zig zap framework 🧐
@AntonPutra
@AntonPutra 2 ай бұрын
haha, will do!
@yuryzhuravlev2312
@yuryzhuravlev2312 2 ай бұрын
I think firstly he should fix implementation, it's defentelly wrong results.
@FrankTaylorLieder
@FrankTaylorLieder 2 ай бұрын
Thanks for making this video. I too was surprised by the results: why do they show Rust so much slower (latency) and why does it consume more CPU and fluctuating level of CPU (there is no GC to add periodic overhead)? I took the code and ran test 1 (static get devices) locally (M1 Mac Studio) to see if I could repro your results. I found something different. Both Go and Rust performed incredibly similarly: about 570us per request... But I was driving it with 50 concurrent threads achieving about 27k requests per second. I get similar results at 100 concurrent threads (50k requests/s). Further, with these tests I see Rust taking 55% CPU / 9MB RAM consistently, whilst Go is fluctuating 130-180% CPU / 20 MB RAM during the run. My results are not directly comparable with yours (not network between the client and server, different machine, etc)... but the relative performance is comparable. I see latency parity between the two languages. This is what I would expect for such a simple test... returning static data, both compiled and optimised languages. As expected I see Go using more memory and a little more CPU to cover off its overheads like GC. Can you double check your Prometheus graphs to make sure the CPU usage graphs are the right way around? I can't come up with a suggestion for the differing latency figures... Any ideas Anton?
@AntonPutra
@AntonPutra 2 ай бұрын
thank you for taking the time! The issues was a client running in the Kubernetes pod (job), i have improved test design and now can achieve ~20k RPS in Kubernetes with 2cpu and 256mi memory. it does not mean previous tests were incorrect it just client wasn't able to generate more load Also, someone raised a PR to improve Rust code, so I will retest and if it makes a difference release a result - github.com/antonputra/tutorials/tree/main/lessons/203/rust-app-v2
@FrankTaylorLieder
@FrankTaylorLieder 2 ай бұрын
​@@AntonPutra Thanks for replying. I look forward to seeing the updated results. Coming back to the CPU graph. I saw from your video today that all three Go frameworks generated load fluctuations. Your graphs for test1 in this video show Go with almost completely level/smooth CPU and Rust with quite variable CPU usage. Can you confirm that the graph key is the right way around... That said, I am super impressed with the performance of Go in these tests.
@AntonPutra
@AntonPutra 2 ай бұрын
​@@FrankTaylorLieder I'll double-check. This time, I generated the load from 20 different pods in K8s instead of just one. Also, I added random sleep in the Go client, which could potentially cause spikes. When I reduced the random sleep time interval from 1000ms to 40ms, the graph looked much smoother. Old go client - github.com/antonputra/tutorials/blob/main/lessons/201/client/request.go#L16-L18 Updated Rust code - github.com/antonputra/tutorials/tree/main/lessons/203/rust-app-v2
@-domitori-
@-domitori- Ай бұрын
Thank you for the double check
@carlosm.1233
@carlosm.1233 2 ай бұрын
Watching these tests make me realize that I made the best decision to go all in with Go! Thank you, Anton! Great work as always.
@AntonPutra
@AntonPutra 2 ай бұрын
thanks, but i'm getting a lot of tips how to improve Rust code as well as couple of PRs. so I'll retest and release results soon! PR - github.com/antonputra/tutorials/pull/253 PR - github.com/antonputra/tutorials/pull/252
@carlosm.1233
@carlosm.1233 2 ай бұрын
@@AntonPutra The same can be argued about the Go code as well. I am quite certain that if you tweak the Go code here and there, it could be a lot faster. But as for Go being a garbage collected language and going toe to toe with a non garbage collected like Rust is very impressive. Anyways, keep them tests coming. You actually made me revisit the thought of learning Rust in the future ;)
@edihasrin7290
@edihasrin7290 2 ай бұрын
@@AntonPutra I'm really looking forward to a fair comparison
@Takatou__Yogiri
@Takatou__Yogiri 2 ай бұрын
@@carlosm.1233 it's because his code is not optimzed enough. Rust can easily beat GO if he uses good code. it's his skill issue.
@kal.leroux
@kal.leroux 2 ай бұрын
can you please make a video about how to benchmark and monitor a backend service effectively
@AntonPutra
@AntonPutra 2 ай бұрын
ok, at some point! but i already have 5-6 videos on how to monitor/instrucment stuff
@PouriyaJamshidi
@PouriyaJamshidi 2 ай бұрын
Nice video and I appreciate your approach. Would love to see some Nim in the mix
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! noted!
@Endorsememe
@Endorsememe 2 ай бұрын
Probably the AWS Rust SDK is still a littlebit undercooked.
@AntonPutra
@AntonPutra 2 ай бұрын
yeah i know, especially for rust. they recently deprecated rust runtime for lambda i think they don't spend a lot of time on maintaining and improving rust sdk
@everyhandletaken
@everyhandletaken 2 ай бұрын
I think irrespective of the result, the Go performance is extremely good, for quite a high level language. It would be really interesting to see a top 3 most performant server frameworks for bother Go & Rust, then put them against each other. Quite a few people are saying Axom for Rust & probably FastHTTP would be expected to be the fastest for Go? I like that you consider real world usage & not just simply number of requests for a hello world endpoint, much more realistic.
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! i'm going to release a new benchmark GO (stdlib vs fiber vs gin) in couple of days, next Rust (actix vs axum vs roket), let me know if i should consider different frameworks
@everyhandletaken
@everyhandletaken 2 ай бұрын
@@AntonPutra I will be keen to watch that one, great! I would definitely love to see Echo & FastHTTP tested for Go at some point 😊
@manosragiadakos3928
@manosragiadakos3928 2 ай бұрын
I would like to see Elixir (or Gleam) vs Go
@AntonPutra
@AntonPutra 2 ай бұрын
will do!
@rafaelcapucho
@rafaelcapucho Ай бұрын
+1 dor Exilir
@pi3ni0
@pi3ni0 2 ай бұрын
Why services cannot handle more than 1.6k requests in Test 1 when we still have CPU/RAM resources available?
@__Michu__
@__Michu__ 2 ай бұрын
Great question. I'm wondering about that too
@pi3ni0
@pi3ni0 2 ай бұрын
@@baxiry. Could you elaborate more, please? I understood that all packets reached services via network, but they were "dropped" i.e. HTTP 503 is returned ? Maybe there was a low timeout in the client?
@__Michu__
@__Michu__ 2 ай бұрын
@@pi3ni0 he couldn't. isn't network handled by kernel anyway?
@AntonPutra
@AntonPutra 2 ай бұрын
let me know what metrics to expose next time... I'll try network, maybe packets will see..
@__Michu__
@__Michu__ 2 ай бұрын
@@AntonPutra i think it's less about metrics and more about conclusions from the benchmark
@zakriyarahman
@zakriyarahman 2 ай бұрын
Great content as always! Keep them coming! One suggestion I recommend is comparing between cloud providers as well when doing these tests.
@AntonPutra
@AntonPutra 2 ай бұрын
thanks, noted! I'll see if it makes sense i'll use gcp as well or maybe azure
@zakriyarahman
@zakriyarahman 2 ай бұрын
@@AntonPutra all 3 would be great
@deirdrechong8269
@deirdrechong8269 2 ай бұрын
Excellent video yet again. Can you do golang / rust vs c++? Also, would like to see more real world cpu extensive task like compression and encryption
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! will do!
@wanarchives
@wanarchives 2 ай бұрын
I see a lot of Go videos now, now lets try PHP vs Go!
@AntonPutra
@AntonPutra 2 ай бұрын
one more coming Go (stdlib vs fiber vs gin) tomorrow or after tomorrow :) but thanks, added to the list!
@__Michu__
@__Michu__ 2 ай бұрын
Awesome vid
@AntonPutra
@AntonPutra 2 ай бұрын
thanks!
@dhirendratripathi891
@dhirendratripathi891 2 ай бұрын
from long time waited for this ...
@AntonPutra
@AntonPutra 2 ай бұрын
thanks!
@waltermenezes9365
@waltermenezes9365 2 ай бұрын
Hi there, wonderful work, i would like to see Free Pascal (mormot ) vs go or Rust, since free pascal mormot qualifyes 12º in tech empower metrics, cheers
@AntonPutra
@AntonPutra 2 ай бұрын
thanks for the suggestion, noted!
@rafaelnatera97
@rafaelnatera97 2 ай бұрын
Amazing comparison 👏
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! :)
@gabrielkwong1878
@gabrielkwong1878 2 ай бұрын
would like to see Axum vs Actix vs Fiber but maybe too late for that? or maybe another episode with more metrics? I am not sure myself what additional metrics people want to see.
@AntonPutra
@AntonPutra 2 ай бұрын
thank you, noted! i'll release a short benchmark Go (stdlib vs fiber vs gin) maybe tomorrow or after tomorrow. probably will do Rust (actix vs axum vs roket) next
@gabrielkwong1878
@gabrielkwong1878 2 ай бұрын
@AntonPutra i sus pect actix will be more performant than axum but Axum has better dev experience? As axum is marketed to jave better ergonomics. But will be nice to see avtix and axum at scale, just to have it in the video books.
@ivan.angulo
@ivan.angulo 2 ай бұрын
Go AWS SDK v2 is one of the most completed and well inline-documented implementations of the SDK and the S3 (and S3 manager) is the biggest module, so I guess the AWS put a lot of effort optimizing it.
@AntonPutra
@AntonPutra 2 ай бұрын
i guess so, but i got a lot of feedback how to improve rust code so i'll retest it and release in a couple of days
@Nvimchad
@Nvimchad 2 ай бұрын
can you make rust (axum) vs go(fiber). or other with comparing rust (axum)
@AntonPutra
@AntonPutra 2 ай бұрын
yes next
@CulturedSkate77
@CulturedSkate77 2 ай бұрын
A full baterías comparison between a Python framework like Django (industry standard) vs some go alternative would be interesting to see
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! noted will do django soon!
@shubhamvishwakarma3427
@shubhamvishwakarma3427 Ай бұрын
You should avoid python and performance in the same sentence
@konoko-o3o
@konoko-o3o 2 ай бұрын
It's very interesting to see comparisons like this, especially with Actix and Fiber, which are among the fastest tools for backend development in Rust and Go, respectively. The specific requirements of each project can heavily influence the choice of tool. While Fiber boasts lower latency per request and less CPU usage, it does consume more memory. On the other hand, Actix might have higher latency and use more CPU, but it's significantly more memory-efficient. Considering that memory is more expensive than CPU usage in cloud services, this trade-off becomes even more crucial if you are deploying the service on-premises or in the cloud. Additionally, Go's ease of use makes it simpler to onboard new developers, even those without prior experience, whereas Rust might have a steeper learning curve. It's always a good practice to encourage developers to conserve memory allocation when working with Go, given its tendency towards higher memory consumption. These subtle observations can significantly influence the choice of tool depending on the project's specific requirements.
@AntonPutra
@AntonPutra 2 ай бұрын
i've been using Go for the client to generate load and had to use 8xlarge instance, when i switched to Rust i only need 4xlarge ec2, 50% saving for me to run these tests :)
@666marat666chanel
@666marat666chanel 2 ай бұрын
Спасибо за видео, познавательно и неожиданно :)
@AntonPutra
@AntonPutra 2 ай бұрын
spasibo :)
@LinuxForLife
@LinuxForLife 2 ай бұрын
It would interesting to change Actix by Axum, for Rust.
@AntonPutra
@AntonPutra 2 ай бұрын
next time i just run test between those two, if you think i should instrument anything specific like how long it takes to serialize json for each framework let me know
@LinuxForLife
@LinuxForLife 2 ай бұрын
@@AntonPutra In fact I have saw reports from Discord and why they have change from Go to Rust. Their graphics do not show the same behaviour mostly with CPU, that is why I was wondering if it was, may be , a matter of framework. Will see ... Anyway your work is 👍 . Congrats!
@AntonPutra
@AntonPutra 2 ай бұрын
@@LinuxForLife I saw it a while ago, but I hope someone from Discord can explain their use case where Rust performs better so that I can reproduce it. I'm not hiding anything, the source code is public. It's just examples from the official docs of the SDKs and frameworks I use🤷‍♂
@thom1218
@thom1218 2 ай бұрын
Great test! Is Grafana able to capture and display spans and traces like Datadog, if you're familiar with that APM? For example, an API call is made to web service A, which in turn calls web service B that persists some data to a database. I'm interested in Grafana's ability to display the chain of these calls, their durations, the API hostname, URL, parameters, etc, on a time-line, or in a waterfall view. In Datadog, this is known as a "trace". Does Grafana have a similar concept?
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! yes it can, i have tutorial tracing with open telemetry - kzbin.info/www/bejne/kHqxaHtmZdqfh9k
@GabrielPozo
@GabrielPozo 2 ай бұрын
Excellent video!!!
@AntonPutra
@AntonPutra 2 ай бұрын
thanks :)
@alberkhan
@alberkhan 2 ай бұрын
Please do PHP Swoole vs Go and Rust
@AntonPutra
@AntonPutra 2 ай бұрын
noted! will do!
@outwithrealitytoo
@outwithrealitytoo 2 ай бұрын
Having seen these results - I think I might put in some pull requests for Linux drivers written on Golang! (topical Geek joke). It was fascinating to see two compiled languages going head to head. I was surprised to see them being so neck and neck, Memory usage was the principal difference, and on that I have some comments (in no way a criticism of the video which was illuminating and objective, in running the two languages against one another in default configuration - like most people use them). Memory usage is not really an efficiency metric, because a garbage collecting language will only carry out a full garbage collect when necessary. Necessary being hitting the defined threshold. Typically this would be configured to 80% of available memory - you can see this when when the load increases and there is an initial spike. Resource pools and statically sized queues are also a reason that memory usage of an application can appear initially appear high, but then not get any higher. As an embedded software engineer, the approach was that memory is not there to be squandered but it is there to be used and abused, to keep down latency. Caching previously loaded and potentially still useful disk pages in RAM is another example of this. This is something the OS will do for the app if you let it - but that usage has to be accounted for against one process or another. So, the takeaway is - memory can be traded for latency - and you can code or configure an app to play to either of these as priority dictates. If you know the load in advance you can vary the budgets considerably. Caveats : I have had to say "the compression algorithm will take up more room than the data" and databases often default to linear searches because using an index is slower than just going through the data (the point being that you shouldn't assume complex algorithms make things quicker). IOPS on the database store can be an almost invisible bottleneck. I'd like to see a Node.JS app added to the mix. The compiled languages people expect it to be rubbish, but I suspect it would run Rust and Golang close on this app (if you are going to allow "go routines" you would have to allow multiple Node instances listening on the same port).
@AntonPutra
@AntonPutra 2 ай бұрын
thanks for taking a time to leave this feedback i'll definitely use nodejs in the future benchmarks. by the way i got some PRs to improve my Rust code it i just release results which very different from what i had before
@mariogutierrez4989
@mariogutierrez4989 2 ай бұрын
The scales are a bit deceiving. They look more drastic than they really are. Considering how much less time it takes to write a program a Go language with concurrency, I would choose Go. We're talking about a 10% difference in performance right? Unless you're facebook, google scale it's good enough.
@AntonPutra
@AntonPutra 2 ай бұрын
agree, go is simpler and easier to find developers to hire
@horseinthesky
@horseinthesky 2 ай бұрын
Thank you for the tutorials, Anton! Would you upload client code and monitoring manifests to the github for this lesson?
@AntonPutra
@AntonPutra 2 ай бұрын
i have old version of the client - github.com/antonputra/tutorials/tree/main/lessons/201/client as well as monitoring staff - github.com/antonputra/tutorials/tree/main/lessons/202/monitoring i keep iterating over and in some time in the future release it
@RootsterAnon
@RootsterAnon 2 ай бұрын
This is wild!
@AntonPutra
@AntonPutra 2 ай бұрын
haha
@mrtfttkhv
@mrtfttkhv 2 ай бұрын
Good one! Really disappointed in rust😢 hope to see better results from axum
@AntonPutra
@AntonPutra 2 ай бұрын
just got pr to improve rust, will see if it make any difference - github.com/antonputra/tutorials/pull/251
@bstech4803
@bstech4803 2 ай бұрын
Please do Axum vs Actix comparison.
@AntonPutra
@AntonPutra 2 ай бұрын
Please do Axum vs Actix comparison. I got a lot of feedback how to improve this one as well as few PRs. I'll release update rust vs go maybe tomorrow or after tomorrow
@ibrahimshehuibrahim918
@ibrahimshehuibrahim918 2 ай бұрын
Nice one Go we are proud of you 😂😂😂😂
@AntonPutra
@AntonPutra 2 ай бұрын
haha
@sunilkumar-xp7jz
@sunilkumar-xp7jz 2 ай бұрын
Awesome, thanks 💖👍🙏🙏🙏
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! :)
@its_Khoa
@its_Khoa 2 ай бұрын
oh, next one can do compare real time use case ? like large amount of messages to process
@AntonPutra
@AntonPutra 2 ай бұрын
yes, i was thinking about kafka consumer/producer, maybe simple etl pipeline etc
@montycodes
@montycodes 2 ай бұрын
Hi @Anton, You have a very great content. Can you please help me which software you use for creating these animated videos.
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! sure it's asobe suite
@armchair-architect
@armchair-architect 2 ай бұрын
Fascinating results, Go's latency and CPU usage is actually lower than that of Rust in the two tests. Awesome remark about not scaling pods horizontally based on CPU and Memory alone, as degradation happened before they even started to peak.
@AntonPutra
@AntonPutra 2 ай бұрын
thank you!
@BrazilMentionedHueHue
@BrazilMentionedHueHue 2 ай бұрын
Great video, -If I could, I would suggest doing the same test comparing golang, C# and java given the popularity of those and the fact they are GC- (You did videos for this as well, nice!). For this test, for me, the CPU usage is weird, I was expecting to be the same or rust using less CPU, maybe golang is using better compiler optimizations?
@voiceofthetrue1849
@voiceofthetrue1849 2 ай бұрын
I don't mind to give Go a little bit more of memory ;)
@AntonPutra
@AntonPutra 2 ай бұрын
me either, haha
@DavidSmith-ef4eh
@DavidSmith-ef4eh 2 ай бұрын
Go beats rust? well that was unexpected. what could be the reasons behind this? better implementation of the frameworks core functionality in go?
@AntonPutra
@AntonPutra 2 ай бұрын
i got a lot of feedback how to improve Rust code as well as couple of PRs, so I'll retest in a few days and release resutls
@yatsuk
@yatsuk 2 ай бұрын
@AntonPutra could you try Swift vs Go?
@AntonPutra
@AntonPutra 2 ай бұрын
yes, will do!
@lielfr
@lielfr 2 ай бұрын
Not an expert but I think the Rust code can be slightly optimized: get_devices seems to allocate the vector every time it runs, which can be time consuming, and also you might squeeze a bit more performance with parking_lot and RwLock instead of Mutex. Another interesting approach would be to use message passing for updating the metrics instead. Other than that, great work!
@AntonPutra
@AntonPutra 2 ай бұрын
i tried just to hit /healthz endpoint with "ok" string, same results, nothing to optimize there :)
@rajivkumar-ub6uj
@rajivkumar-ub6uj 2 ай бұрын
Hi Anton, I'm still waiting for your monitoring setup in docker compose file
@AntonPutra
@AntonPutra 2 ай бұрын
yeah i know :) take a look at these tutorials for now Monitoring EKS & EC2 instances with MANAGED Prometheus & Grafana - github.com/antonputra/tutorials/tree/main/lessons/130
How to monitor Persistent Volume usage in Kubernetes using Prometheus? - github.com/antonputra/tutorials/tree/main/lessons/134
How to monitor Containers in Kubernetes using Prometheus & cAdvisor? - github.com/antonputra/tutorials/tree/main/lessons/135 Monitor HTTP/REST API in Kubernetes using Prometheus & Nginx Ingress Controller - github.com/antonputra/tutorials/tree/main/lessons/136 How to Monitor Golang with Prometheus (Counter - Gauge - Histogram - Summary) - github.com/antonputra/tutorials/tree/main/lessons/137
How to Monitor Nginx with Prometheus and Grafana? (Install - Monitor - Fluentd) - github.com/antonputra/tutorials/tree/main/lessons/140 Prometheus Operator Kubernetes Tutorial - github.com/antonputra/tutorials/tree/main/lessons/154
How to Build Custom Prometheus Exporter? - github.com/antonputra/tutorials/blob/main/lessons/141 OpenTelemetry Golang Tutorial (Tracing in Grafana & Kubernetes & Tempo) - github.com/antonputra/tutorials/tree/main/lessons/178

Take a look at all lessons here in the readme - github.com/antonputra/tutorials/blob/main/docs/contents.md
@AdamPoniatowski
@AdamPoniatowski 2 ай бұрын
can you do a similar benchmark but between go and zig? that would be interesting to know which one would fare better in the long run
@TheWellington1997
@TheWellington1997 2 ай бұрын
Please make a video comparing dart(vania) and go(whatever)
@AntonPutra
@AntonPutra 2 ай бұрын
ok noted
@likwidsage
@likwidsage 2 ай бұрын
In B4 crustaceans say you did it wrong.
@AntonPutra
@AntonPutra 2 ай бұрын
i got a lot of feedback how to improve Rust code as well as couple of PRs. i'll retest in a couple of days and release results
@dgtemp
@dgtemp 2 ай бұрын
Suggestion: Can you please change the graph colors to something more distinguishable. Although I can identify the colors but some people may not and its also easier to check the difference.
@AntonPutra
@AntonPutra 2 ай бұрын
ok will do! those are the defaults grafana uses
@dgtemp
@dgtemp 2 ай бұрын
@@AntonPutra Yes I thought so.
@Anonymous-jt3yz
@Anonymous-jt3yz 2 ай бұрын
Can u explain how you are scaling the clients and number of requests.
@AntonPutra
@AntonPutra 2 ай бұрын
sure, i have a golang client config: stages: - clients: 5 intervalMin: 5 - clients: 10 intervalMin: 5 - clients: 15 intervalMin: 5 example: func mainTest(m *metrics, client *http.Client, c Config) { for i, stage := range c.Stages { guard := make(chan struct{}, stage.Clients) // Set Prometheus number of clients metric m.clients.Set(float64(stage.Clients)) // Set Prometheus test stage metric m.stage.Set(float64(i)) now := time.Now() for { guard
@IvanGeorgiev
@IvanGeorgiev 2 ай бұрын
Please make a video about Go fiber VS Java Helidon
@AntonPutra
@AntonPutra 2 ай бұрын
thanks, noted!
@alekc7292
@alekc7292 Ай бұрын
i interesting same test Actix (Rust) vs Fiber (Go) 1. Simple requests (without body or very small static body) 2. Simple requests (with body 1kb 100kb 1mb) [need read all data request to io.Discard] 3. simple request with database can you do this?
@massy-3961
@massy-3961 2 ай бұрын
Fiber vs Axum would be nice
@AntonPutra
@AntonPutra 2 ай бұрын
thanks for the suggestion, noted!
@yuryzhuravlev2312
@yuryzhuravlev2312 2 ай бұрын
I think implementation is wrong if they start return errors so quickly. Also rust response time around 1ms for empty response raise a questions about debug mode or something like this.
@AntonPutra
@AntonPutra 2 ай бұрын
i got a lot of feedback as well as few PRs how to improve Rust code, will release results in a day or so
@muhammadabdi9458
@muhammadabdi9458 2 ай бұрын
in the real world, which better for resources efficiency? better cpu usage + latency or better memory usage?
@AntonPutra
@AntonPutra 2 ай бұрын
latency, use experience is always comes first!
@bitcoinxofficial
@bitcoinxofficial 2 ай бұрын
Great job
@AntonPutra
@AntonPutra 2 ай бұрын
thank you!
@bitcoinxofficial
@bitcoinxofficial 2 ай бұрын
@@AntonPutra I wrote our backend in golang for 3 years now.
@AntonPutra
@AntonPutra 2 ай бұрын
@@bitcoinxofficial time to rewrite it in rust😂 just joking
@bitcoinxofficial
@bitcoinxofficial 2 ай бұрын
​@@AntonPutrait is better to stick with the language that you expert for building products rather than investing in every new languages or technologies. Because we just need a final product in the end.
@AntonPutra
@AntonPutra 2 ай бұрын
@@bitcoinxofficial true
@SariAlHiari
@SariAlHiari 2 ай бұрын
@Anton What needs to change to allow the application to keep serving until it bumps against CPU or memory limits??
@AntonPutra
@AntonPutra 2 ай бұрын
i guess increase the timeout and also increase the number of clients that generate load
@andherium
@andherium 2 ай бұрын
damn! That's why I love Go!
@AntonPutra
@AntonPutra 2 ай бұрын
haha
@svetlinzarev3453
@svetlinzarev3453 2 ай бұрын
Why did not you use release profile settings geared towards performance ? Enable LTO=thin and codegen-units=1. Also these results does not seem correct. Did you compile the rust app in release mode ?
@AntonPutra
@AntonPutra 2 ай бұрын
I got a couple of PRs as well as suggestions like this to improve performance. I'll retest it in a few days and release results. thanks for the feedback! PR - github.com/antonputra/tutorials/pull/253 PR - github.com/antonputra/tutorials/pull/252 and yes it was compiled in release mode - github.com/antonputra/tutorials/blob/main/lessons/203/rust-app/Dockerfile#L7
@georgehelyar
@georgehelyar 2 ай бұрын
Nit: degredation is a word but it comes from degrade/degraded not degredate/degredated.
@maniacZesci
@maniacZesci 2 ай бұрын
Rust version probably spawns number of threads from the start, hence higher CPU usage. It would be more comparable to see Rust using Tokio for true concurrency but I have no idea what Actix uses behind the scenes. I would want to see you compare it with more popular framework like Axum.
@AntonPutra
@AntonPutra 2 ай бұрын
thanks, i'm getting a lot of tips how to improve the Rust code so I'll retest and release results soon. I can also measure how many treads each app creates with this - "container_threads" Github - github.com/google/cadvisor/blob/master/docs/storage/prometheus.md#monitoring-cadvisor-with-prometheus
@THE_NE0
@THE_NE0 2 ай бұрын
I expected to have go vs c# with AOT
@AntonPutra
@AntonPutra 2 ай бұрын
will do, next week probably
@pawegraczyk6050
@pawegraczyk6050 2 ай бұрын
Axum is number 1 for many months now, yet every youtube video is still with actix-web...
@AntonPutra
@AntonPutra 2 ай бұрын
is it better?
@八玲珑
@八玲珑 2 ай бұрын
@@AntonPutra AUXM is better ,i always use it!
@some84884
@some84884 2 ай бұрын
@@AntonPutra it's kinda better, but probably using axum won't show significant benefits here. While the only interest here was it built in release mode?
@some84884
@some84884 2 ай бұрын
I see release mode in sources
@rafaelnatera97
@rafaelnatera97 2 ай бұрын
What is the implication to be on release mode?
@egarizkysetiawan9384
@egarizkysetiawan9384 21 күн бұрын
GOat
@dmitrii_cl
@dmitrii_cl 2 ай бұрын
Hey! Sorry about stupid questions. If we use optimized OS, like Clear Linux or CachyOS, will we see some benefits? I saw different tests on Phoronix, and it looked like it can help. One PHP benchmark showed about 2x speed (but I think it was just benchmark without i/o). But those tests were launched without containers, if I not mistaken.
@AntonPutra
@AntonPutra 2 ай бұрын
possibly, but most people use managed Kubernetes clusters like EKS (aws), GKE (gcp) and AKS (azure) which comes with pre built AMI (os images). i just want to cover the same use cases and environments that most people would use
@dmitrii_cl
@dmitrii_cl 2 ай бұрын
@@AntonPutra interesting, especially about Clear Linux. I have to check, how Intel use it, I'm sure that they made it for servers 🤔 It's strange if cloud providers don't want to get some benefits
@pawanpyakurel7540
@pawanpyakurel7540 2 ай бұрын
can you test with axum actix and rocket?
@AntonPutra
@AntonPutra 2 ай бұрын
yes, but first i want to compare fiber vs stdlib vs gin or chi
@MrTrollland
@MrTrollland 2 ай бұрын
get_devices from main has the potential to be wildly inefficient. It's not even so much about the vector not being const (uuid! is validated at compile time). The problem may be in the mac and firmware fields of the Device struct. With the current implementation it's a whole wonder why Device has owned data as opposed to string slices. What you end up doing is paying the price for a heap allocation (as stated in the docs for From for String) which you don't need since this data can be a &'static str. On top of that one doesn't need UTF-8 strings to represent MAC addresses and firmware versions. Using an ascii string is something that both solutions would benefit from. Hopefully rustc is smart enough to figure all of these things out and not include all of the above mentioned overhead, I haven't analyzed the function that closely.
@AntonPutra
@AntonPutra 2 ай бұрын
Thank you for the feedback, actually one of the PRs that i received is to change uuid to string - github.com/antonputra/tutorials/pull/252 as well as another one to improve performance - github.com/antonputra/tutorials/pull/253 I'll retest in a couple of days along with some other tips and release results
@polrk
@polrk 2 ай бұрын
Can u test go/rust vs userver (c++)
@AntonPutra
@AntonPutra 2 ай бұрын
yes soon!
@aliimranalfred
@aliimranalfred 2 ай бұрын
I strongly suggest to reupload this very same test by adding below lines in rust-app's `Cargo.toml` file ``` [profile.release] lto = true strip = true opt-level = 'z' panic = 'abort' codegen-units = 1 ``` I am very curious to see the after results...
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! I'll try it. Also someone raised a PR to improved rust code, let me know what do you think? - github.com/antonputra/tutorials/tree/main/lessons/203/rust-app-v2
@ramyakmehra312
@ramyakmehra312 2 ай бұрын
i think axum is a much lighter framework and more closer to fibre
@AntonPutra
@AntonPutra 2 ай бұрын
will test!
@shyrogan2341
@shyrogan2341 2 ай бұрын
Would be great to try with Axum
@AntonPutra
@AntonPutra 2 ай бұрын
will do little bit later
@kevins7621
@kevins7621 Ай бұрын
Can you do a Rust vs C++?
@AntonPutra
@AntonPutra Ай бұрын
yes soon
@wwloyd
@wwloyd 2 ай бұрын
I am so in love with GO ❤❤
@AntonPutra
@AntonPutra 2 ай бұрын
i'll try assembly next time, lol
@ggcc3261
@ggcc3261 2 ай бұрын
I think this shows that Discord was wrong to throw their entire codebase away for their "performance" issues with Go. There was something else going on there IMO and not just "Go slow we move to Rust haha"
@AntonPutra
@AntonPutra 2 ай бұрын
I had a Golang client that generated load, and I had to use 8xlarge instances. After rewriting it in Rust, I was able to use 4xlarge instances, 50% infra savings for me for running these tests.
@FuriusaoxD
@FuriusaoxD 2 ай бұрын
I would very scared just to use those instances 😅
@AntonPutra
@AntonPutra 2 ай бұрын
yeah, the secret is to setup alarm to delete them, lol
@朝秦-f2h
@朝秦-f2h 2 ай бұрын
java/spring vs c#/dotnet, thank you
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! noted!
@berkepalamutcu9397
@berkepalamutcu9397 2 ай бұрын
can you test fastapi and some other library or framework?
@AntonPutra
@AntonPutra 2 ай бұрын
yes, next test
@Sushank777
@Sushank777 2 ай бұрын
i don't understand at 1.5k RPS if they are using only 10% Memory, 8% CPU then why they are falling?
@AntonPutra
@AntonPutra 2 ай бұрын
i got a lot of tips how to improve rust code as well as few PRs, will release updated results in a couple of days. that particular issue was due to absence of timeouts on the client side
@ahmadrezadorkhah9574
@ahmadrezadorkhah9574 2 ай бұрын
did you build the rust app in release mode?
@AntonPutra
@AntonPutra 2 ай бұрын
yes, and i got a few PRs to improve rust code, will release results soon
@ahmadrezadorkhah9574
@ahmadrezadorkhah9574 2 ай бұрын
@@AntonPutra thanks
@ahmadrezadorkhah9574
@ahmadrezadorkhah9574 2 ай бұрын
@@AntonPutra Also consider `opt-level = "s"` and `strip = true` for `[profile. Release]` in Cargo.toml file.
@maniacZesci
@maniacZesci 2 ай бұрын
Why don't you accept PR and test improved Rust code?
@AntonPutra
@AntonPutra 2 ай бұрын
which one? I already merged 2 PRs.. I'll test soon.. PR - github.com/antonputra/tutorials/pull/253 PR - github.com/antonputra/tutorials/pull/252
@maniacZesci
@maniacZesci 2 ай бұрын
@@AntonPutra I would like to see you test both if you can, other than that I do not know which version would be better. Maybe 253 first though as I see more optimizations have been made.
@rafael.aloizio1769
@rafael.aloizio1769 2 ай бұрын
Isso é maravilhoso [portuguese pt-br]
@AntonPutra
@AntonPutra 2 ай бұрын
thanks!
@oriontvv
@oriontvv 20 күн бұрын
use let now = Instant::now(); and now.elapsed() for rust for benches. not SystemTime. It's quite strange why it uses so much cpu at the begining. need to dig into sources
@sighup124
@sighup124 2 ай бұрын
Go is amazing! But whenever you see C/C++/Zig being beaten by Go/Java/etc. you know something’s wrong…
@AntonPutra
@AntonPutra 2 ай бұрын
Well, I got a lot of tips and a couple of PRs to improve my Rust code. I'll publish the results in a few days. It can beat Go's standard library, but even Rust experts weren't able to optimize the AWS SDKs to make them more efficient than Go's AWS SDK v2 🤷‍♂️
@maniacZesci
@maniacZesci 2 ай бұрын
@@AntonPutra They actually did and according to their official blog Rust is faster, I can't post links because my comments get deleted, but Google search can give you top level results.
@sighup124
@sighup124 2 ай бұрын
@@AntonPutra sounds great! Hmm well yes possible the AWS lib just isn’t there yet but then that’s an implementation issue on AWS side. No wonder considering how they create their sdks 😬
@adcodes
@adcodes 2 ай бұрын
IMHO, Go wins. 🎖 Go uses three times more memory but four times less CPU. I think Go is the better choice, since the performance is only in memory usage which doesn't actually translate to more requests per second, and also the same app in Go has better latency (although I'm not sure if it noticeable). Thanks for the video.
@AntonPutra
@AntonPutra 2 ай бұрын
thank you! i got a lot of tips how to improve Rust code, will retest it in a few days and release results!
@satisfyingly1
@satisfyingly1 2 ай бұрын
FastAPI vs Robyn
@AntonPutra
@AntonPutra 2 ай бұрын
thanks! noted!
@OldKing11100
@OldKing11100 2 ай бұрын
Go Fiber is cheating with HTTP1.1 which is why I use it for my high volume CMS. I don't see the landscape of Web Servers changing much until HTTP3 QUIC becomes standard. Honestly any Web Service is going to be winner by simply using Go or Rust over Python or Node (compiled over interpreted).
@AntonPutra
@AntonPutra 2 ай бұрын
thanks for the feedback! fiber seems to be very fast, i'm going to release Go (stdlib vs fiber vs gin) in a couple of days
@ulrich-tonmoy
@ulrich-tonmoy 2 ай бұрын
So go is better choice here as writing code is easier and it takes more memory than rust but others are similar or better can you do one with erlang vm lang like elixir or gleam vs go or rust
@AntonPutra
@AntonPutra 2 ай бұрын
thanks, noted!
@andriidrihulias6197
@andriidrihulias6197 2 ай бұрын
Check pls ,kotlin ktor and go
@AntonPutra
@AntonPutra 2 ай бұрын
thanks, noted!
@artyomzverev
@artyomzverev 2 ай бұрын
Ahahahaha, are you serious? Еще интересно причем тут EKS
@diegomaradona336
@diegomaradona336 2 ай бұрын
наверное при то том что это не синтетика, а приближенный к реальному использованию бенч?
@artyomzverev
@artyomzverev 2 ай бұрын
@@diegomaradona336 и какой тип инстансов там используется? в этом реальном тесте
@AntonPutra
@AntonPutra 2 ай бұрын
da
@AntonPutra
@AntonPutra 2 ай бұрын
m6a.2xlarge
@UTl0l
@UTl0l 2 ай бұрын
One important thing that these benchmarks doesn't take into consideration when choosing a programming language or framework is the developer feedback loop. For instance, I know that python is probably one of the slowest (in execution time) programming languages that are used for web applications. However the developer feedback loop is such a big difference compared to the compiled languages, that I would have it as my default go to language.
@AntonPutra
@AntonPutra 2 ай бұрын
i like python as well, you can write data pipelines with spark and ml stuff so python is not going anywhere
HELP!!!
00:46
Natan por Aí
Рет қаралды 76 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
Why I Chose Rust Over Zig
33:18
ThePrimeTime
Рет қаралды 210 М.
Rust vs Go: Performance Benchmark in Kubernetes #205
17:16
Anton Putra
Рет қаралды 168 М.
Why Rust is NOT a Passing Fad...
8:54
Travis Media
Рет қаралды 43 М.
41% Increased Bugs With Copilot
29:54
ThePrimeTime
Рет қаралды 236 М.
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 640 М.
I Didn’t Believe that AI is the Future of Coding. I Was Right.
6:55
Sabine Hossenfelder
Рет қаралды 589 М.
Rust vs Go : Hands On Comparison
50:40
ThePrimeTime
Рет қаралды 235 М.
HELP!!!
00:46
Natan por Aí
Рет қаралды 76 МЛН