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

Поділитися
Вставка
  • Опубліковано 8 лис 2024

КОМЕНТАРІ • 305

  • @AntonPutra
    @AntonPutra  2 місяці тому +9

    ► What should I test next?
    ► AWS is expensive - Infra Support Fund: buymeacoffee.com/antonputra
    ► Benchmarks: ua-cam.com/play/PLiMWaCMwGJXmcDLvMQeORJ-j_jayKaLVn.html&si=p-UOaVM_6_SFx52H

    • @qizhang5749
      @qizhang5749 2 місяці тому +4

      Elixir vs Go

    • @AntonPutra
      @AntonPutra  2 місяці тому +3

      @@qizhang5749 in the pipeline!

    • @Autystyczny
      @Autystyczny 2 місяці тому +4

      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 місяці тому +1

      @@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 місяці тому +37

    Great work (as always), Anton. Your visual explanations are top notch.

  • @TweakMDS
    @TweakMDS 2 місяці тому +4

    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

  • @Lewboskii
    @Lewboskii 2 місяці тому +6

    finally some good non micro benchmarks that test realistic use of the languages. elixir vs go would be interesting to see

    • @AntonPutra
      @AntonPutra  2 місяці тому +2

      thanks! will do elixir as well soon

  • @tmaffia
    @tmaffia 2 місяці тому +1

    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 місяці тому +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 місяці тому +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

  • @ulvigulu
    @ulvigulu 2 місяці тому +1

    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 місяці тому +1

      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

  • @ionutale1950
    @ionutale1950 2 місяці тому +5

    this is a great performance test.
    well done

  • @FrankTaylorLieder
    @FrankTaylorLieder 2 місяці тому +4

    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 місяці тому +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- 19 днів тому

      Thank you for the double check

  • @pi3ni0
    @pi3ni0 2 місяці тому +31

    Why services cannot handle more than 1.6k requests in Test 1 when we still have CPU/RAM resources available?

    • @__Michu__
      @__Michu__ 2 місяці тому +4

      Great question. I'm wondering about that too

    • @pi3ni0
      @pi3ni0 2 місяці тому +1

      @@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 місяці тому +1

      @@pi3ni0 he couldn't. isn't network handled by kernel anyway?

    • @AntonPutra
      @AntonPutra  2 місяці тому +3

      let me know what metrics to expose next time... I'll try network, maybe packets will see..

    • @__Michu__
      @__Michu__ 2 місяці тому +4

      @@AntonPutra i think it's less about metrics and more about conclusions from the benchmark

  • @JaiminBrahmbhatt
    @JaiminBrahmbhatt 2 місяці тому +1

    Love the comparison great to see this. Amazing work.

  • @ManuelMartinez-nl5cy
    @ManuelMartinez-nl5cy 2 місяці тому +37

    PLEASE Go need to rest for the next battle 😂. Great work 🎉

  • @Bleibruk
    @Bleibruk 2 місяці тому +1

    Wow! I loved this video! Thanks!
    I started to love histogram data for horizontal scaling...

  • @carlosm.1233
    @carlosm.1233 2 місяці тому +3

    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 місяці тому +3

      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 місяці тому +1

      @@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.

  • @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

  • @PouriyaJamshidi
    @PouriyaJamshidi 2 місяці тому +2

    Nice video and I appreciate your approach.
    Would love to see some Nim in the mix

  • @everyhandletaken
    @everyhandletaken 2 місяці тому +4

    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 місяці тому +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 😊

  • @deirdrechong8269
    @deirdrechong8269 2 місяці тому +6

    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

  • @kal.leroux
    @kal.leroux 2 місяці тому +9

    can you please make a video about how to benchmark and monitor a backend service effectively

    • @AntonPutra
      @AntonPutra  2 місяці тому +2

      ok, at some point! but i already have 5-6 videos on how to monitor/instrucment stuff

  • @ziad_m_404
    @ziad_m_404 2 місяці тому +34

    Can I suggest a short video showing how you created those custom dashboards in grafana 👀?!

    • @AntonPutra
      @AntonPutra  2 місяці тому +14

      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 місяці тому +3

      @@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 місяці тому +13

    Now we need comparison with zig zap framework 🧐

    • @AntonPutra
      @AntonPutra  2 місяці тому +1

      haha, will do!

    • @yuryzhuravlev2312
      @yuryzhuravlev2312 2 місяці тому

      I think firstly he should fix implementation, it's defentelly wrong results.

  • @Endorsememe
    @Endorsememe 2 місяці тому +8

    Probably the AWS Rust SDK is still a littlebit undercooked.

    • @AntonPutra
      @AntonPutra  2 місяці тому +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

  • @manosragiadakos3928
    @manosragiadakos3928 2 місяці тому +10

    I would like to see Elixir (or Gleam) vs Go

  • @outwithrealitytoo
    @outwithrealitytoo 2 місяці тому +1

    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

  • @dhirendratripathi891
    @dhirendratripathi891 2 місяці тому +1

    from long time waited for this ...

  • @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

  • @gabrielkwong1878
    @gabrielkwong1878 2 місяці тому +3

    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 місяці тому +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.

  • @CulturedSkate77
    @CulturedSkate77 2 місяці тому +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

  • @wanarchives
    @wanarchives 2 місяці тому +2

    I see a lot of Go videos now, now lets try PHP vs Go!

    • @AntonPutra
      @AntonPutra  2 місяці тому +1

      one more coming Go (stdlib vs fiber vs gin) tomorrow or after tomorrow :) but thanks, added to the list!

  • @rafaelnatera97
    @rafaelnatera97 2 місяці тому +1

    Amazing comparison 👏

  • @viniciusmorgado9722
    @viniciusmorgado9722 Місяць тому

    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  Місяць тому

      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 :)

  • @mrtfttkhv
    @mrtfttkhv 2 місяці тому +1

    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

  • @666marat666chanel
    @666marat666chanel 2 місяці тому +1

    Спасибо за видео, познавательно и неожиданно :)

  • @LinuxForLife
    @LinuxForLife 2 місяці тому +17

    It would interesting to change Actix by Axum, for Rust.

    • @AntonPutra
      @AntonPutra  2 місяці тому +3

      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 місяці тому +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 місяці тому +5

      @@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🤷‍♂

  • @__Michu__
    @__Michu__ 2 місяці тому +3

    Awesome vid

  • @armchair-architect
    @armchair-architect 2 місяці тому +4

    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.

  • @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?

  • @GabrielPozo
    @GabrielPozo 2 місяці тому +1

    Excellent video!!!

  • @waltermenezes9365
    @waltermenezes9365 2 місяці тому +1

    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!

  • @RootsterAnon
    @RootsterAnon 2 місяці тому +1

    This is wild!

  • @thom1218
    @thom1218 2 місяці тому +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 місяці тому +4

      thank you! yes it can, i have tutorial tracing with open telemetry - ua-cam.com/video/ZIN7H00ulQw/v-deo.html

  • @pawegraczyk6050
    @pawegraczyk6050 2 місяці тому +71

    Axum is number 1 for many months now, yet every youtube video is still with actix-web...

    • @AntonPutra
      @AntonPutra  2 місяці тому +7

      is it better?

    • @八玲珑
      @八玲珑 2 місяці тому

      @@AntonPutra AUXM is better ,i always use it!

    • @some84884
      @some84884 2 місяці тому +12

      @@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 місяці тому +1

      I see release mode in sources

    • @rafaelnatera97
      @rafaelnatera97 2 місяці тому +1

      What is the implication to be on release mode?

  • @ibrahimshehuibrahim918
    @ibrahimshehuibrahim918 2 місяці тому +2

    Nice one Go we are proud of you 😂😂😂😂

  • @sunilkumar-xp7jz
    @sunilkumar-xp7jz 2 місяці тому +1

    Awesome, thanks 💖👍🙏🙏🙏

  • @bstech4803
    @bstech4803 2 місяці тому +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

  • @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 місяці тому +1

      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

  • @mariogutierrez4989
    @mariogutierrez4989 2 місяці тому +3

    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 місяці тому +2

      agree, go is simpler and easier to find developers to hire

  • @alberkhan
    @alberkhan 2 місяці тому +6

    Please do PHP Swoole vs Go and Rust

  • @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

  • @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 місяці тому +3

      i tried just to hit /healthz endpoint with "ok" string, same results, nothing to optimize there :)

  • @voiceofthetrue1849
    @voiceofthetrue1849 2 місяці тому +3

    I don't mind to give Go a little bit more of memory ;)

  • @andherium
    @andherium 2 місяці тому +5

    damn! That's why I love Go!

  • @bitcoinxofficial
    @bitcoinxofficial 2 місяці тому +1

    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 місяці тому +1

      ​@@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 місяці тому +1

      @@bitcoinxofficial true

  • @its_Khoa
    @its_Khoa 2 місяці тому +1

    oh, next one can do compare real time use case ? like large amount of messages to process

    • @AntonPutra
      @AntonPutra  2 місяці тому +1

      yes, i was thinking about kafka consumer/producer, maybe simple etl pipeline etc

  • @Nvimchad
    @Nvimchad 2 місяці тому +17

    can you make rust (axum) vs go(fiber). or other with comparing rust (axum)

  • @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

  • @georgehelyar
    @georgehelyar 2 місяці тому

    Nit: degredation is a word but it comes from degrade/degraded not degredate/degredated.

  • @DavidSmith-ef4eh
    @DavidSmith-ef4eh 2 місяці тому +1

    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 місяці тому +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

  • @wwloyd
    @wwloyd 2 місяці тому +3

    I am so in love with GO ❤❤

    • @AntonPutra
      @AntonPutra  2 місяці тому +1

      i'll try assembly next time, lol

  • @massy-3961
    @massy-3961 2 місяці тому +2

    Fiber vs Axum would be nice

    • @AntonPutra
      @AntonPutra  2 місяці тому

      thanks for the suggestion, noted!

  • @MrTrollland
    @MrTrollland 2 місяці тому +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

  • @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

  • @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 місяці тому +1

      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

  • @yatsuk
    @yatsuk 2 місяці тому +1

    @AntonPutra could you try Swift vs Go?

  • @ggcc3261
    @ggcc3261 Місяць тому +1

    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  Місяць тому

      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.

  • @egarizkysetiawan9384
    @egarizkysetiawan9384 8 днів тому

    GOat

  • @rajivkumar-ub6uj
    @rajivkumar-ub6uj 2 місяці тому +1

    Hi Anton, I'm still waiting for your monitoring setup in docker compose file

    • @AntonPutra
      @AntonPutra  2 місяці тому +1

      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

  • @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 місяці тому +1

      ok will do! those are the defaults grafana uses

    • @dgtemp
      @dgtemp 2 місяці тому

      @@AntonPutra Yes I thought so.

  • @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?

  • @SariAlHiari
    @SariAlHiari Місяць тому

    @Anton What needs to change to allow the application to keep serving until it bumps against CPU or memory limits??

    • @AntonPutra
      @AntonPutra  Місяць тому +1

      i guess increase the timeout and also increase the number of clients that generate load

  • @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

  • @likwidsage
    @likwidsage 2 місяці тому +3

    In B4 crustaceans say you did it wrong.

    • @AntonPutra
      @AntonPutra  2 місяці тому +1

      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

  • @aliimranalfred
    @aliimranalfred 2 місяці тому +1

    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 місяці тому +1

      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

  • @Anonymous-jt3yz
    @Anonymous-jt3yz 2 місяці тому +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

  • @THE_NE0
    @THE_NE0 2 місяці тому +3

    I expected to have go vs c# with AOT

    • @AntonPutra
      @AntonPutra  2 місяці тому +4

      will do, next week probably

  • @TheWellington1997
    @TheWellington1997 Місяць тому

    Please make a video comparing dart(vania) and go(whatever)

  • @IvanGeorgiev
    @IvanGeorgiev 2 місяці тому +1

    Please make a video about Go fiber VS Java Helidon

  • @muhammadabdi9458
    @muhammadabdi9458 2 місяці тому +1

    in the real world, which better for resources efficiency? better cpu usage + latency or better memory usage?

    • @AntonPutra
      @AntonPutra  2 місяці тому +3

      latency, use experience is always comes first!

  • @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

  • @FuriusaoxD
    @FuriusaoxD 2 місяці тому +1

    I would very scared just to use those instances 😅

    • @AntonPutra
      @AntonPutra  2 місяці тому

      yeah, the secret is to setup alarm to delete them, lol

  • @shyrogan2341
    @shyrogan2341 2 місяці тому

    Would be great to try with Axum

    • @AntonPutra
      @AntonPutra  2 місяці тому

      will do little bit later

  • @ramyakmehra312
    @ramyakmehra312 2 місяці тому +1

    i think axum is a much lighter framework and more closer to fibre

  • @朝秦-f2h
    @朝秦-f2h 2 місяці тому +1

    java/spring vs c#/dotnet, thank you

  • @kevins7621
    @kevins7621 Місяць тому

    Can you do a Rust vs C++?

  • @rafael.aloizio1769
    @rafael.aloizio1769 2 місяці тому +1

    Isso é maravilhoso [portuguese pt-br]

  • @pawanpyakurel7540
    @pawanpyakurel7540 2 місяці тому +1

    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

  • @adcodes
    @adcodes 2 місяці тому +4

    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 місяці тому +1

      thank you! i got a lot of tips how to improve Rust code, will retest it in a few days and release results!

  • @polrk
    @polrk 2 місяці тому +1

    Can u test go/rust vs userver (c++)

  • @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 😬

  • @berkepalamutcu9397
    @berkepalamutcu9397 2 місяці тому

    can you test fastapi and some other library or framework?

  • @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 місяці тому +1

      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 місяці тому +1

      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.

  • @satisfyingly1
    @satisfyingly1 2 місяці тому +1

    FastAPI vs Robyn

  • @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 місяці тому +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

  • @oriontvv
    @oriontvv 7 днів тому

    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

  • @ulrich-tonmoy
    @ulrich-tonmoy 2 місяці тому +1

    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

  • @andriidrihulias6197
    @andriidrihulias6197 2 місяці тому +1

    Check pls ,kotlin ktor and go

  • @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

  • @user-xp4mm1zu2y
    @user-xp4mm1zu2y 2 місяці тому

    0:22 "against GIN for go"
    1:01 "against go FIBER framework"
    bro couldn't pick