.NET (C#) vs. Fiber (Go): Performance (Latency - Throughput - Saturation - Availability)

  Рет қаралды 83,756

Anton Putra

Anton Putra

Күн бұрын

Пікірлер: 498
@AntonPutra
@AntonPutra 5 ай бұрын
🔴 To support my channel, I'd like to offer Mentorship/On-the-Job Support/Consulting (me@antonputra.com)
@sangeethnandakumar2534
@sangeethnandakumar2534 5 ай бұрын
Amazing. Bro where can I find your C# and Go code used for testing. Any GitHub links?
@i.t.9015
@i.t.9015 5 ай бұрын
Rust vs Go
@Nick-yd3rc
@Nick-yd3rc 5 ай бұрын
Haskell please 🙏 ChatGPT can help🫠 Scala sttp is a great wrapper, and akka/pekko perform very strongly in general with small heaps🤫
@ulrich-tonmoy
@ulrich-tonmoy 5 ай бұрын
zig vs Rust Zig vs Go Haskell vs Elixir Vs Gleam
@AntonPutra
@AntonPutra 5 ай бұрын
@@ulrich-tonmoy ok, just added to my list!
@__Michu__
@__Michu__ 5 ай бұрын
I like these real world test scenarios. And I love that you increased RPS until failure. Please keep doing that with every benchmark
@__Michu__
@__Michu__ 5 ай бұрын
I wish you would increase RPS in second test as well
@AntonPutra
@AntonPutra 5 ай бұрын
thanks, will do! i started to use eks to run those tests...
@F3nny
@F3nny 2 ай бұрын
Author of Fiber here, keep up the good work. If you are interested you should try enabling the Prefork option for even more performance.
@rifatrahman1417
@rifatrahman1417 22 күн бұрын
as coming from the node background please make the fiber more powerful like express
@terjeber
@terjeber Ай бұрын
One thing to add - about 10% of men have reduced color vision. For those of us, the difference between these two graphs are almost impossible to distinguish.
@Dr-Zed
@Dr-Zed 3 ай бұрын
.NET should not be dropping requests whole using so little CPU. Something about the setup is wrong here.
@Raizin-d8p
@Raizin-d8p Ай бұрын
Not only that but it doesn't make sense to have so many DB connections. I haven't looked at the code but I suspect bad quality code.
@marioschmidt1251
@marioschmidt1251 17 күн бұрын
Back when I coded C#, it was important to set the garbage collector to server-mode for these kind of apps. My guess is that this wasn't done here (if server-mode gc is still a thing today).
@aoisonne1461
@aoisonne1461 6 күн бұрын
​@@Raizin-d8p I thought that was weird too. I looked at the source code and the way he uses IDbConnection is very unusual and likely not thread safe. I also suspect the way the var counter = 0 is used isn't thread safe.
@scosminv
@scosminv 2 ай бұрын
Now that .NET 9 is out, this would need a refresh. New server mode is biased towards low memory consumption + plethora of perf improvements
@mysteriouseyes6960
@mysteriouseyes6960 Ай бұрын
in fact,this benchmark has some issues,he's code show he was use dotnet 8.0 but he not open server gc model,in workstation gc QPS too low。
@oxXPMXxo
@oxXPMXxo Ай бұрын
@@mysteriouseyes6960 the code in go as well. so why not do your own test instead
@actualwafflesenjoyer
@actualwafflesenjoyer 27 күн бұрын
interesting if true, but then why is shit mode the default? 🤔
@scosminv
@scosminv 27 күн бұрын
@@actualwafflesenjoyer even in "shit mode" the GC keeps system memory for future allocations to avoid system alloc calls which are slow. Its a tradeoff between releasing memory early and performance.It's good to be able to choose the mode that suits you. I think in .net 9, low memory footprint is the default.
@antoniusivan8767
@antoniusivan8767 15 күн бұрын
Yeah. when i keep digging. Some go runtime behavior have also an issue. If your application modular monolith, and needed more than just bare minimum runtime, the memory and the size of go app file keep bloating compared to C#. After that, with the video framework of choosing. There is also not directly head to head comparison. Minimal API C# have support for HTTP/2 and HTTP/3, but fiber as based from FastHTTP doesn't. Also if you really want to be a head to head. You have to create the same AOT deployment for both of the language.
@Denominus
@Denominus 5 ай бұрын
Your methodology is excellent. I much prefer this to the gamified mess that techempower has become. Startup time/cost, container size, memory/cpu usage, baseline memory/cpu usage are extremely valuable to us.
@AntonPutra
@AntonPutra 5 ай бұрын
thank you!
@123mrfarid
@123mrfarid 4 ай бұрын
​@@AntonPutra mas anton, ayo bikin site kaya techempower. Hasilnya ditunjukkan di site. Di run setiap tahun sekali utk bahasa2 populer
@yurii1111
@yurii1111 5 ай бұрын
Cool test actually. A few possible improvements except trying the AOT: 1. Try enabling a full PGO (tiered PGO is enabled in .NET 8): # Full PGO ENV DOTNET_TieredPGO=1 ENV DOTNET_TC_QuickJitForLoops=1 ENV DOTNET_ReadyToRun=0 2. Use slim app configuration: WebApplication.CreateBuilder() vs WebApplication.CreateSlimBuilder() 3. Try increasing the minimal number of threads: ThreadPool.GetMinThreads(out _, out int completionPortThreads); ThreadPool.SetMinThreads(100, completionPortThreads);
@AntonPutra
@AntonPutra 5 ай бұрын
thanks for the tip! I'll definitely try it next time!
@kurumi690
@kurumi690 5 ай бұрын
​@@AntonPutra yeap, it would be interesting with Native AOT too
@luvincste
@luvincste 5 ай бұрын
also the two async operations (await cmd.ExecuteNonQueryAsync() and await amazonS3.Upload(appConfig.S3Bucket, image.ObjKey, appConfig.S3ImgPath)) are running sequentially, while they could be started both together and awaited after they both have been started; sure, it's a small to really small improvement, but this is the point of knowing well the language and doing a test well: it's not easy *at all*
@johnhershberg5915
@johnhershberg5915 5 ай бұрын
@@AntonPutra I actually think you tested it fine. AOT is only for startup time. Tiered PGO is the default, so it makes sense to keep it here. My one complaint is that if you want this to be a "real world" test case your code should use Entity Framework as that's the most standard thing. I took a look at the code and you're doing it with Npgsql's built-in datasource. I don't know anyone who would do this in a real world application. There's all sorts of caching that you're missing from Entity Framework. Note that I think the way you did it is actually faster. EF has overhead. But I would still very much like to see that comparison instead.
@neonmidnight6264
@neonmidnight6264 5 ай бұрын
None of these are needed, with vanilla configuration .NET is strictly better than Go. Anyone who ever looked at Go's compiler output and GC throughput knows that both are underwhelming. Note that for *small* deployments like these using NativeAOT is a good idea. .NET 9 also enables DATAS by defvault which is a new GC mode for more dynamic scaling of active heaps and their sizes based on load profile. This massively improves low heapsize scenarios like this one. Generally speaking you have to understad that for high throughput workloads 256mi is anemic. Bump it up to 512mi and you will see a completely different picture. Same applies to more core which .NET's threadpool and task system can utilize much more effectively than fixed runtime threads setup in Go. Lastly, I suspect the culprit here is S3 SDK, as it has quite room for improvemet and Amazon posted like a week ago that the have new preview version which is faster and has much less wasted allocations. The open question is also about Go using connection pool while .NET seemingly avoids opting into that, which would impact the behavior significantly and make it apples to oranges comparison.
@anhcoder
@anhcoder 4 ай бұрын
11 years with .NET at my main jobs (I'm a solution architect), 6 years with Golang (side projects for other clients' companies). I think .NET is more suitable for fast development, quick adaptation to changes, and Enterprise-focused products. Golang is better for cost-efficient projects, but requires more maintenance.
@MrSamisack
@MrSamisack 3 ай бұрын
hi! what do i need to lear to become a .net solution architect?
@anhcoder
@anhcoder 3 ай бұрын
@@MrSamisack it's often start with system thinking, learn how a system works, what are components, how to make it secure and realiablely. 4th-8th years try to build all skillset that you target to be master. .NET ecosystem , Cloud Provider, Database, AI... I spent almost 12-15 hours per days for learn and practices.
@MrSamisack
@MrSamisack 3 ай бұрын
@@anhcoder thanks 🫂
@UCrjhmrVAvDXjApQo4EH
@UCrjhmrVAvDXjApQo4EH 2 ай бұрын
why does goland requires more maintenance
@anhcoder
@anhcoder 2 ай бұрын
@ more code, more simple, more customization, more dead and opensource libs then more maintenance cost.
@paarma1752
@paarma1752 5 ай бұрын
The idle memory usage difference has its reasons. By default dotnet runtime just doesnt release its reserved memory unless there's memory pressure. If you want it to release it more aggressively, you should run it as a desktop workload instead of a server workload (default).
@AntonPutra
@AntonPutra 5 ай бұрын
noted, memory does not play a significant role in these benchmarks
@Sam-gd4xp
@Sam-gd4xp 5 ай бұрын
Oooo reasons, reasons, reasons, come one, face it, Go lang with simpler approach without OOP studpidity rulset has shown it can perform. We kewn all a long, that is a case. Face it, Go lang is the new "C#" as new popular language for beginners. Modern C# is just what C++ was in the 80s. Even C# author said, C# is more C++ replacement that Java replacement.
@paarma1752
@paarma1752 5 ай бұрын
@@Sam-gd4xp oh, I like golang as well and I've used it alot ❤️ But personally I wouldn't have courage to start developing a large scale enterprise-y system with it. Everything being so simple and imperative means there are more statements you'll have to manage, which means you'll have more state to manage, which means there'll be more chance for bugs. Golang's range requires much more statements, state and ceremony than C#'s Select(...).Where(...).GroupBy(...).Join(...).OrderBy(...)... I know there are some more functional slice utils, but still a lot is missing. C#'s LINQ (with and without EF), expressions and way superior generics is something I personally couldn't develop a large scale system without... But I do love to use golang for more algorithmic stuff and I'm also super interested in how golang's generics and itetators will turn out and improve 😋
@keyser456
@keyser456 5 ай бұрын
​@@Sam-gd4xp Don't be a fanboi
@ladrillorojo4996
@ladrillorojo4996 5 ай бұрын
@@Sam-gd4xp No, C# is so flexible that it can and needs to be optimized for a particular task.
@marcwinner567
@marcwinner567 5 ай бұрын
Keep the benchmarks coming! Love it!
@AntonPutra
@AntonPutra 5 ай бұрын
thanks! will do, rust vs go coming in couple of days :)
@zhh174
@zhh174 5 ай бұрын
Use native aot for C#. Memory usage will be way less, and startup time will be very fast
@deado7282
@deado7282 5 ай бұрын
AOT is not a sensitive default since it limits you in terms of 3rd party packages.
@neonmidnight6264
@neonmidnight6264 5 ай бұрын
@@deado7282 it is an ok default if you deploy to piss weak anemic container configurations and then have to scale with replica count and nodes, because go cant optimally do otherwise, instead of scaling up individual container resources, the ecosystem is in a different place now anyway
@AntonPutra
@AntonPutra 5 ай бұрын
i'll try
@ladrillorojo4996
@ladrillorojo4996 5 ай бұрын
@@deado7282 Fiber also limits you. That would be far more fair. Not to mention that there's something bad with the C# build, because my projects are way bigger in code but way smaller when built. He did something bad.
@dasiths
@dasiths 5 ай бұрын
This would be a fair comparison to fiber as it is the fastest option to run aspnetcore.
@cheukmingau983
@cheukmingau983 5 ай бұрын
To further reduce the image size of Golang, you can use UPX to further compress the executable which usually results in 40-50% file size reduction.
@AntonPutra
@AntonPutra 5 ай бұрын
cool, thanks for the tip! i'll try it out. Does it affect performance, or just in case you need to debug something?
@ArnabAnimeshDas
@ArnabAnimeshDas 5 ай бұрын
@@AntonPutra startup time will increase by a miniscule amount as it needs to decompress before running. For this use case, using UPX is a good move as it will reducesdownload time.
@AntonPutra
@AntonPutra 5 ай бұрын
​@@ArnabAnimeshDas got it. unfortunately, it's hard to measure boot time in Kubernetes because the minimal interval is 1 second, and I want to focus these benchmarks on Kubernetes.
@EraYaN
@EraYaN 5 ай бұрын
Also the images are already compressed by the container registry and runtime. So double compression is not all that effective in general. Something like the trimming and Native AOT in .NET does help a bunch though. Go already does a fairly okay job.
@AntonPutra
@AntonPutra 5 ай бұрын
@@EraYaN 👌
@zephyrprime
@zephyrprime 3 ай бұрын
I don’t understand why both start dropping request while cpu usage is nowhere near 100 and memory usage is less than 50%
@shanonjackson5528
@shanonjackson5528 3 ай бұрын
Imagine this might be due to OS syscall bottleneck or physical hardware bottleneck (network card throughput)
@rozrewolwerowanyrewolwer391
@rozrewolwerowanyrewolwer391 3 ай бұрын
maybe one core of processor is used on 100% and other at 20%
@ciprianfc
@ciprianfc 2 ай бұрын
the problem is in the Config.cs, he is loading the entire configuration each time he needs a configuration value.
@IncomingLegend
@IncomingLegend 2 ай бұрын
bogus tests
@pandhuprisnawan165
@pandhuprisnawan165 4 ай бұрын
Congrats you got new subs!! Love with your test, please add more C# comparison
@AntonPutra
@AntonPutra 4 ай бұрын
thanks! will do more in the future
@mmacgearailt
@mmacgearailt 5 ай бұрын
This is the first test video I've seen of yours and I love how thorough you are, from methodology and tools, to the results. However, as someone who is color deficient, I cannot tell the difference between low-contrast colors easily or at all. For your next test, please use high-contrast colors for all test subjects.
@AntonPutra
@AntonPutra 5 ай бұрын
thank you! it's just default colors that Grafana uses for two different subjects, i'll see if i can improve
@jaans3712
@jaans3712 5 ай бұрын
You have found some kind of holy grail of programming content for KZbin 😄 Very addictive videos -> I subscribed
@AntonPutra
@AntonPutra 5 ай бұрын
thank you! :)
@RobinVeldhuis
@RobinVeldhuis 4 ай бұрын
At 8:01 you mention that theres a significant higher latency for C#. It looks worse than it actually is, since the graph doesn't start at zero (unlike the other graphs in this view). The difference is still significant, but being mindful about these things adds clarity for the viewer and potentially saves you from a wrong conclusion in the future :)
@ChandanSomani
@ChandanSomani Ай бұрын
This is really Informative... superb work, super setup, i would really like to learn to do this
@Cuca-hn3md
@Cuca-hn3md 5 ай бұрын
I like this kind of content, you've got one more subscriber! 😊
@AntonPutra
@AntonPutra 5 ай бұрын
thank you! rust vs go coming in couple of days :)
@willl0014
@willl0014 3 ай бұрын
I am loving these videos
@TweakMDS
@TweakMDS 5 ай бұрын
Once again a spectacularly well thought out test. We can say that C# wins a proud silver medal in this head to head :D Would you be interested in a fresh comparison of some of the different javascript runtimes, like node.js, deno and bun?
@AntonPutra
@AntonPutra 5 ай бұрын
thanks! yes but next rust vs go with new updated frameworks and sdks :)
@darkogele
@darkogele 5 ай бұрын
I have never seen dotnet to drop requests if is not 95% plus on cpu ram etc this is just weird.
@AntonPutra
@AntonPutra 5 ай бұрын
i'll add more metrics next time from cadvisor - github.com/google/cadvisor/blob/master/docs/storage/prometheus.md
@SajadJalilian
@SajadJalilian Ай бұрын
You should ask community to create most efficient app they can and give them time to do that on github. Then test them. That would be the best compression in existence
@RockTheCage55
@RockTheCage55 5 ай бұрын
Excellent test & very thorough....thanks.
@AntonPutra
@AntonPutra 5 ай бұрын
thank you!
@Monkeydew1o2
@Monkeydew1o2 2 ай бұрын
It's crazy how closely aligned the GO and C# RPS was to start. There has to be an external limiting factor.
@lczago
@lczago 5 ай бұрын
Do a Go vs PHP please. We know Go is faster, but it would be interesting to see the differences. You can use FrankenPHP or Symfony Flex.
@AntonPutra
@AntonPutra 5 ай бұрын
ok will do in a week or so
@kahnfatman
@kahnfatman 3 ай бұрын
Seems unfair because PHP does not run by itself. Lower level of socket connection is handled by either Apache or Nginx.
@korzhs
@korzhs 3 ай бұрын
Thanks for the thorough test! Why do you use .NET 6 while the latest LTS version is .NET 8 ?
@AntonPutra
@AntonPutra 3 ай бұрын
my pleasure! i used 8.0, you can see it from the source code - github.com/antonputra/tutorials/blob/main/lessons/202/cs-app/Dockerfile#L1
@IvanRandomDude
@IvanRandomDude 5 ай бұрын
I mean, it is gin, one of the slowest go libraries. You used Fiber in the last video.
@AntonPutra
@AntonPutra 5 ай бұрын
microsoft compared .net with gin, i used fiber in this video - github.com/antonputra/tutorials/blob/main/lessons/202/go-app/main.go#L12
@einstein_god
@einstein_god 5 ай бұрын
Gin is not slow…
@AntonPutra
@AntonPutra 5 ай бұрын
@@einstein_god I've been using it for benchmarks, it is definitely slower than fiber..
@mrt2525
@mrt2525 5 ай бұрын
I'm sure you didn't make any adjustments to the operating system. .net core doesn't give me any problems until it reaches 50k/sec.
@AntonPutra
@AntonPutra 5 ай бұрын
no vanila kubernetes cluster with containerd runtime. 2cpu and 256mb memory - github.com/antonputra/tutorials/blob/main/lessons/202/deploy/cs-app/deployment.yaml#L26-L32 have you tried it in k8s or just standalone? default file descriptors 1024 could play a role as well
@davidmartensson273
@davidmartensson273 4 ай бұрын
I was also surprised, I did some local test during spring for our new services and could easily handle 15 000 requests per second on my machine, though I did not run under k8s and did have more memory and CPU. BUT I did not test 15 000 clients though. @AntonPutra did your test use concurrent clients doing separate calls or just requests? That could make a difference I think, especially if the clients connect using HTTP/2 in which case one client would be able to do many many more requests in the same time since you save on TCS setup, and that might account for the higher numbers I got.
@kovlabs
@kovlabs 5 ай бұрын
Nice work Can you do Java vs C# next ?
@AntonPutra
@AntonPutra 5 ай бұрын
thanks, maybe not next but i'll do it for sure
@Tolg
@Tolg 5 ай бұрын
@@AntonPutra Please do! Looking forward to seeing the same test between Java vs C#. Also would be great to use .Net Native AOT.
@AntonPutra
@AntonPutra 5 ай бұрын
@@Tolg i got PR for aot so i'll be definitely testing it soon.. - github.com/antonputra/tutorials/tree/main/lessons/202/cs-app-aot so i'll be testing
@vekzdran
@vekzdran 2 ай бұрын
As a dotnet guy... it is hard to watch :-) ... go rocks!
@AntonPutra
@AntonPutra 2 ай бұрын
i'll make an updated video soon with .NET 9
@vekzdran
@vekzdran 2 ай бұрын
@@AntonPutra you are very kind to do so, you have my subscription and already shared with colleagues. We would love to know if AOT version will help out. I was amazed to see Rust beat Go also. But, dotnet is doing better and better, and your tests give us some hope in this space also. :)
@sinanbozkus
@sinanbozkus 3 ай бұрын
Great video, thank you!
@amrabdelhady
@amrabdelhady 5 ай бұрын
Why some requests start to drop? I see the CPU utilization and memory usage are very far from 100%. Where is the bottle neck coming from?
@AntonPutra
@AntonPutra 5 ай бұрын
it depends on the implementation of the http server, some prefer to drop others try to process every single request...
@hupett
@hupett 5 ай бұрын
My thoughts exactly. Something in the setup of both versions are bad, neither go and c# seems to utitlize resources nowhere near 100%, yet they all start failing request. Maybe they can't see the resources they have available or similar and they are throtthling themselves by using less thread/connection/something that they could. Go (fiber) ofc will win anyways, but based on my very similar tests, the difference is only 10-15% in requests per second and this was with net6, not net8 (which can be significantly faster).
@metaltyphoon
@metaltyphoon 5 ай бұрын
@@hupett his repo has .net 8 not 6
@hupett
@hupett 5 ай бұрын
​@@metaltyphoon yes, which means the margin should be even smaller for him compared to what I measured in net6 era, since net8 is faster then net6. My tests were capping cpu, but here we can see both frameworks failing without using the available resources, so something seems off.
@viacheslavsamodelkin6944
@viacheslavsamodelkin6944 5 ай бұрын
This is where GC starts to kick in. If we use something like dotnet-monitor for monitoring GC in Prometheus that might show us the real picture
@TheBerserkFury
@TheBerserkFury 5 ай бұрын
Shoutout to the homelab cluster! I’ve got my entire homelab setup declarative for GitOps use!
@AntonPutra
@AntonPutra 5 ай бұрын
cool :)
@lukavranes2492
@lukavranes2492 5 ай бұрын
Very informative as always, thanks also just a thought, maybe revisit apache vs nginx. mpm_event module for apache with default config sounds pretty strong I'd like to see how they would compare now keep up the good work
@AntonPutra
@AntonPutra 5 ай бұрын
thank you! will do! is mpm_event module enabled by default or i need to turn it on?
@AaronMartinColby
@AaronMartinColby 4 ай бұрын
Genuinely shocked by these results.
@flygonfiasco9751
@flygonfiasco9751 Ай бұрын
.NET framework is an overloaded term in the .NET ecosystem since it refers to the legacy framework
@sikor02
@sikor02 3 ай бұрын
I did a memory test once too, and was surprised that simple C# api took about 1gb of memory. But then I've lowered the memory of the container. For the same API for GO and .NET both AoT and JIT i was able to go down to: - 14 MB for .NET 7 AoT - 16 MB for GO - 21 MB for .NET 7 (JIT) I've run my containers like "docker run -it --rm -m 21m -p..." and used Bombardier to measure throughput, and I was able to handle around 61k requests per second for GO and 57k requests for .NET For values lower than that, the app would crash. However GO was interesting. For 15 MB of memory, it handled 30k requests but didn't crash. It crashed when constrained to 14 MB.
@olebogengthothela1191
@olebogengthothela1191 3 ай бұрын
Why .NET 7 and not .NET 8 or 9?
@sikor02
@sikor02 3 ай бұрын
@@olebogengthothela1191 By the time I did it, the .NET 7 was the latest. Out of curiosity I tested it with .net8 and strangely results were (for the same API that returns the same 3 items from a fixed "TODO" list in GO (using Gin) and C#): C# AOT: 370k req/s GO: 262k req/s C# JIT: 400k req/s I was stunned. I haven't checked memory usage, I haven't containerized them, but I've tested just performance that generates the same JSON response from simple GET endpoint using Bombardier (load testing tool written in GO). All my 32 cores were used at about 81% in both cases for the test duration (around a minute)
@pickle1987
@pickle1987 2 ай бұрын
.net and java are known to be memory sinkhole
@pytorche6206
@pytorche6206 5 ай бұрын
I had a look at the source code a and configuration after the last video and I wondered why you used minIO. Thanks for giving the explanation. I did not know it supports (partially) the S3 API. At work, we have an application that uses it but more as a cloud agnostic object storage. The use cases here are more realistic than the tech empower benchmarks ones. The none fixed size of the DB pool for DotNet impacts the latency, opening a connection to the DB (especially if TLS was used) is expensive.
@AntonPutra
@AntonPutra 5 ай бұрын
thanks! minio can also be used as a replacement for hadoop for some data lake stuff, etc. It uses significantly less disk space while supporting the same replication, but it's harder to scale. If you are on-prem, it's a viable alternative. I agree with the pool size, just the defaults, no more, no less.
@daymaker_trading
@daymaker_trading Ай бұрын
C# .NET 9 vs Java 🔥 Would be awesome! Thank you!
@oxXPMXxo
@oxXPMXxo Ай бұрын
Why C# fanboys always crying when they dont get the result that they want. If you want more optimization the same thing can happen in go. Do your own test without biases.
@jaradaty88
@jaradaty88 21 күн бұрын
I guess because the hard learning curve for using and registering it is libs
@pushthetemple
@pushthetemple 5 ай бұрын
maybe try some functional or new language? i suggest elixir and gleam for next video:)
@AntonPutra
@AntonPutra 5 ай бұрын
okay, will do. i hope they have up to date aws sdks. :)
@murat.yuceer
@murat.yuceer 4 ай бұрын
Can you try again with .net 9
@AntonPutra
@AntonPutra 4 ай бұрын
yes in the new benchmark i'll use .9 version
@murat.yuceer
@murat.yuceer 4 ай бұрын
@@AntonPutra do you use ef core, if you do, use dbcontextfactory in offical doc
@alberkhan
@alberkhan 5 ай бұрын
Can you please create a comparison video between go and PHP Swoole?
@AntonPutra
@AntonPutra 5 ай бұрын
ok!
@xelesarc1680
@xelesarc1680 5 ай бұрын
I like this comparison keep up like this for benchmark maybe with aot make some difference
@AntonPutra
@AntonPutra 5 ай бұрын
thanks, I'll try AOT next time
@kamurashev
@kamurashev 5 ай бұрын
Nice stuff! Thanks
@AntonPutra
@AntonPutra 5 ай бұрын
thank you!
@MagicNumberArg
@MagicNumberArg 5 ай бұрын
Hey, great job! One comment I have is: a lot will come down to how good the Amazon S3 and Postgres are optimized, and in DOTNET MS SQL and Azure Blobs will probably be a priority. Could you do a dedicated test for streaming back local file by id (from disk)? That would show how much HTTP connections specifically each app can handle.
@AntonPutra
@AntonPutra 5 ай бұрын
Thanks! I was actually thinking about Kafka consumer/producer implementations and maybe a simple ETL pipeline. What do you think?
@THE_NE0
@THE_NE0 5 ай бұрын
This comparison is not fair, as you didnt compile the minimal api using AOT
@bibahbibah5108
@bibahbibah5108 5 ай бұрын
still c# have a very good perform, i think it has the best performance for a general us language
@AntonPutra
@AntonPutra 5 ай бұрын
Well, I used the available documentation that most people would use to compile and build Docker images. I'm pretty sure you can optimize both Go and C# further. But I get your point, and next time I'll test with AOT as well. If you have anything that could help me optimize .NET, please share it, and I'll definitely use it!
@AntonPutra
@AntonPutra 5 ай бұрын
have you tried rust? :)
@bebobauomy1265
@bebobauomy1265 5 ай бұрын
@@AntonPutra unless you change the algorithm you uses, there is not a lot of options that can be used to optimize your Go app, you only have the PGO (which also can be used with C#). In C# you just have to compile the program like Go to get a better performance.
@THE_NE0
@THE_NE0 5 ай бұрын
@@AntonPutra luckily when you create a .NET solution you have the choice of selecting web api with AOT, which is a very good starting point, i strongly recommend you to check it out as it has a huge performance difference and the boot time is reduced, the only downside i would say is the image size. I made a POC for my company, it was a stress test of 1000 concurrent users making 1000 requests each and the memory stayed at 30mb with cpu to 1.5%
@MrLOPIU22
@MrLOPIU22 5 ай бұрын
great video
@AntonPutra
@AntonPutra 5 ай бұрын
thank you!
@PouriyaJamshidi
@PouriyaJamshidi 5 ай бұрын
Nice video You might enjoy using Nim as well. Could be an interesting comparison
@AntonPutra
@AntonPutra 5 ай бұрын
thanks, i'll take a look
@pegasusgemini6541
@pegasusgemini6541 13 күн бұрын
Cool! Can you please share the client loader app ?
@carlobenedetti2407
@carlobenedetti2407 5 ай бұрын
I am curious about the performance of .NET Orleans compared to Go
@AntonPutra
@AntonPutra 5 ай бұрын
ok, noted!
@Yilz19
@Yilz19 11 күн бұрын
This needs to be revisited, since .NET 9.0 has been released. Also, I think there is something wrong with your setup. .NET shouldn't be dropping connections while using only a fraction of the available resources.
@davilinkicefire
@davilinkicefire 5 ай бұрын
The comparison seem kind of fair, but they're room for improvement, but i think that a good general "default" setup representation. But small precision (with a little history): It's not dotnet api or dotnet core, it's the aspnetcore framework just like gin/fiber are web framework that you're testing against, they may exist other web framework for .NET, but i agree that is most popular and used one. Nowadays it's just .NET (or dotnet) no "Framework", when we say .NET framework, it mean the old .NET Stack that was only working/designed to work on windows (yeah.. yeah...I know about MONO, but that out of the scope for this simple history) dotnet core was/is the rewrite of the .NET stack from scratch. Microsoft choose to call it dotnet core, because at first it was only a subset of library (the core part), and apsnet core was also the rewrite from scratch of the web framework stack that only supported a subset of the aspnet MVC api, why they didn't change aspnetcore to aspnet, because it's already exist (they were (as far as i know) 3 Microsoft's web framework: ASPNET, ASPNET WebForm, ASPNET MVC (with 3 version of that framework is recall correctly)). So why did they change .NET core to .NET ? i don't know the real reason, but i have some idea like stopping people to not use the new improve version of .net because in their head .NET framework is the supported version of Microsoft versus .NET Core was not as feature complete and not maintainted as good by microsoft because it's now not part of the automatic windows update. Fun fact that most people don't know, but a certain point in time, you were able to start a apsnetcore project using the .NET framework and this was not a hack, it was a valid use case, but today the required version of .NET for aspnercore is too high and .NET framework support was dropped, but switching from aspnetcore using .NET framework to aspnetcore using .NET Core (now know as .NET) was really easy.
@AntonPutra
@AntonPutra 5 ай бұрын
Thanks for the clarification. I didn't have any experience with .NET, but someone suggested trying it out with Minimal API, so I did. I'm learning a lot from the feedback I get, lol.
@jozsab1
@jozsab1 5 ай бұрын
I personally would love some exotic test like Rust, c++ ( oatpp, crow.. ), apache compared to GO.
@AntonPutra
@AntonPutra 5 ай бұрын
noted!
@jozsab1
@jozsab1 5 ай бұрын
@@AntonPutra after i made the comment youtube recomended your rust, node, java ... comparisons. awesome work !
@jozsab1
@jozsab1 5 ай бұрын
@@AntonPutra while at it. I see more an more job postings for python django, fast api, flask. I would expect these to perform "bad", but so many people choose them. I wonder if they are good or not
@AntonPutra
@AntonPutra 5 ай бұрын
​@@jozsab1 It's a very reliable and well-tested framework. We've been running Django as the main API gateway at the company where I work for the last few years with no issues at all. However, most of our other microservices are written in Go :)
@jozsab1
@jozsab1 5 ай бұрын
@@AntonPutra I'm not a webdev, for me it's just raw numbers vs raw numbers. For you, maybe a topic to explore / make another video
@flygonfiasco9751
@flygonfiasco9751 Ай бұрын
You could have used distroless image for .NET as well. 8.0-noble-chiseled
@dsha256
@dsha256 3 ай бұрын
Interesting, thanks! What about Temporal vs Kafka next?
@AntonPutra
@AntonPutra 3 ай бұрын
ok noted!
@nanonkay5669
@nanonkay5669 5 ай бұрын
Basically, if you want something that works and easy, go with Java, C#, Node. If you want improved performance and efficiency without too much work, go with Go. If you want the most performance, speed and efficiency you can get, with the downside of complexity, go with C, C++, Rust
@AntonPutra
@AntonPutra 5 ай бұрын
Rust is not ready for the cloud, with poorly maintained SDKs, and many of them are just slower than Go implementations. But in theory, Rust should be second after C.
@Comeyd
@Comeyd 5 ай бұрын
@@AntonPutrareally? What did you use? That has not been my experience with Rust at all!
@AntonPutra
@AntonPutra 5 ай бұрын
@@Comeyd actix with aws sdk and postgres driver + prom client, i'll publish in a day or so including source code
@rtm0076
@rtm0076 9 күн бұрын
Why u dont compile dotnet to AOT?
@SeyedarmanFatemi
@SeyedarmanFatemi 2 ай бұрын
Hey, can you please compare latest version of dotnet 9 with golang again?
@AntonPutra
@AntonPutra 2 ай бұрын
yes will do soon
@MrSamisack
@MrSamisack 3 ай бұрын
Excellent video with a very very good testing methodology! Just one note: next time can you use colors that are better differentiated? (i'm colorblind). Thanks!
@darkogele
@darkogele 2 ай бұрын
Hey Anton can you redo the tests now with .NET 9 that is out? Microsoft claims that is 10 times faster then NodeJS(Express) and 5 times Faster then Go(GIN)
@0xd3c0d3d
@0xd3c0d3d 5 ай бұрын
I would love to see an experiment like this with Zig someday.
@AntonPutra
@AntonPutra 5 ай бұрын
noted!
@akknaodinden
@akknaodinden 5 ай бұрын
Автор плодит холивары. Почему-то он взял AspNetCore старой версии, не запублишил(то есть нет компайла в AOT нейтив), без тримминга без ничего и сравнивает производительность с Go(который по умолчанию AOT), ближайшим аналогом которого для тестирования подобных задач больше подошел бы Blazor из мира Dotnet.
@VoroninPavel
@VoroninPavel 5 ай бұрын
AOT не надо, PGO после "прогрева" должен дать более оптимизированный код, чем получится при AOT.
@VoroninPavel
@VoroninPavel 5 ай бұрын
Интересно другое: (из доков) When multiple containerized apps are running on one machine, Workstation GC might be more performant than Server GC
@akknaodinden
@akknaodinden 5 ай бұрын
@@VoroninPavel У меня фобия что после PGO что-то отпадёт.
@VoroninPavel
@VoroninPavel 5 ай бұрын
@@akknaodinden ну это только если там бага какая суровая. Еще интересно бы посмотреть на тест не с CreateBuilder, а CreateSlimBuilder()
@VoroninPavel
@VoroninPavel 5 ай бұрын
@@akknaodinden странно. Ютьюб как-то через раз ответы отправляет. Писал, что интересно еще сравнить производительность, когда не CreateBuilder, а CreateSlimBuilder
@nordeenhasan6030
@nordeenhasan6030 4 ай бұрын
I really didnot expect Golang will perform better than .NET, thanks.
@AntonPutra
@AntonPutra 4 ай бұрын
i got some advice how to improve, wil update soon
@ml_serenity
@ml_serenity 4 ай бұрын
Scenario matters. Also, .NET 9 will have a lot of optimizations, so would be interesting to see how it fares.
@jylpah
@jylpah 4 ай бұрын
Why? Bytecode (.NET) vs. native machine code (Go)
@VoroninPavel
@VoroninPavel 4 ай бұрын
@@jylpah byte code is relevant only for the startup, then it is jitted. .net runtime is not interpreter.
@jylpah
@jylpah 4 ай бұрын
@@VoroninPavel Well. Memory consumption. This interpreted vs. machine code discussion has been for 25+ years since Java became popular. JIT code can be fast, but in performance critical applications, machine code wins always. But is the pain of machine code worth of the sometimes minor gains is completely another thing. This was just pure performance. In practice the question is broader techno-economic question.
@romankoshchei
@romankoshchei 4 ай бұрын
Will you test with Native AOT C# app?
@AntonPutra
@AntonPutra 4 ай бұрын
yes, next week. first python then c#aot
@justanaveragebalkan
@justanaveragebalkan 22 күн бұрын
Well that test is slightly biased, clearly .net here is being handicapped by the limited amount of memory that it can consume, due the way the threading pool works in the language if there isn't enough memory it will start dropping requests, which is what make it less ideal for a micro service architecture and while Microsoft has made a lot of effort to fix this during the years it will always remain a fundamental flaw withing the language for that particular use case. That is the very same reason why when the applications first start C# jumps to about 31-35% memory, it's not actually using that memory, it's just taking a reserve for future allocations, but in a case where it can't take more it just fails. I personally like golang more myself, so i use it whenever i can, however C# is also a great language, and overall solid choice.
@Chinauptodate
@Chinauptodate 3 ай бұрын
well, i can say that Golang is a beast
@papa_ethan
@papa_ethan 5 ай бұрын
Best if you can draw conclusions.
@AntonPutra
@AntonPutra 5 ай бұрын
thanks, i'll try it
@IgnacioTaranto
@IgnacioTaranto 5 ай бұрын
It seems you didn't read any of the comments from the Go/Java comparison, the Go binary can be further reduced by removing debugging symbols with the linker options `-s -w`. You are also using an outdated AWS SDK.
@AntonPutra
@AntonPutra 5 ай бұрын
it is in this video, and the difference is only 6 MB - kzbin.info/www/bejne/a2e3hpmtms9-nNE I'll update sdk in the next lesson, but it does not affect performance it's just a wrapper around rest api
@Myself0094
@Myself0094 3 ай бұрын
Nice work, man. One thing is I wonder why dotnet starts to drop packets and latency having so few of the cpu time and memory consumed. I managed to make it serve smth like several thousands of requests per second on a single thread with 200mb of ram and batched sql server inserts, on a windows machine though
@faximori
@faximori 5 ай бұрын
Please repeat the test in November with .NET 9
@AntonPutra
@AntonPutra 5 ай бұрын
will do, i got a lot of feedback how to optimize it as well, haha
@msotho
@msotho 5 ай бұрын
Go is solid!
@AntonPutra
@AntonPutra 5 ай бұрын
it is, with very little optimization, and it's very fast
@JeremyKruer
@JeremyKruer 3 ай бұрын
How realistic is it to use Fiber for production workloads? What is a more realistic framework for enterprise prod workloads in Go?
@AntonPutra
@AntonPutra 3 ай бұрын
i think standard library is goon enough since 1.21
@papa_ethan
@papa_ethan 4 ай бұрын
C# VS Java?
@AntonPutra
@AntonPutra 4 ай бұрын
ok coming
@JoshuaAndrewsza
@JoshuaAndrewsza Ай бұрын
Please can we get an update for .net 9?
@lintaoamons5712
@lintaoamons5712 4 ай бұрын
should also compare the image size
@AntonPutra
@AntonPutra 4 ай бұрын
noted
@dondonondon8577
@dondonondon8577 3 ай бұрын
is it Delphi from Embarcadero good in 2024?
@TuNguyenHuu-i7f
@TuNguyenHuu-i7f 2 ай бұрын
Delphi is still one of the best UI library and IDE. But the price is so crazy
@leonperes
@leonperes 5 ай бұрын
Would be interesting to know how to setup all this
@AntonPutra
@AntonPutra 5 ай бұрын
well i have all source code, including terraform, helm charts everything even dashboards in the repo, link in the description - github.com/antonputra/tutorials/tree/main/lessons/202
@riendlyf
@riendlyf 5 ай бұрын
Can you uncover cloud language winglang? What is your opinion about this approach ?
@AntonPutra
@AntonPutra 5 ай бұрын
interesting, looks like they integrate cloud sdks to the standard library.. so it sort of wrapper around all clouds? how well it is supported? I'll take a look...
@guoard
@guoard 5 ай бұрын
Perfect
@AntonPutra
@AntonPutra 5 ай бұрын
thanks :)
@Ryudith
@Ryudith 4 ай бұрын
Please test elixir phoenixframework compare to golang fiber and rust actix web. Thanks. 😁
@AntonPutra
@AntonPutra 4 ай бұрын
ok noted!
@ThinksOfNature
@ThinksOfNature 2 ай бұрын
HI CAN YOU DO one for golang and swift - hummingbird?
@kucingmania9983
@kucingmania9983 Ай бұрын
Golang leading overall. Should be golang vs rust
@ajiics3469
@ajiics3469 5 ай бұрын
Please test drogon framework 🙏
@AntonPutra
@AntonPutra 5 ай бұрын
this one? drogon.org/
@suyulmaz4
@suyulmaz4 5 ай бұрын
@@AntonPutra it would ne interesting to see a c++ web framework and go comparison.
@AntonPutra
@AntonPutra 5 ай бұрын
​@@suyulmaz4 Sure, any specific C++ framework in mind? Also, would you add any new test scenarios?
@ucretsiztakipci6612
@ucretsiztakipci6612 5 ай бұрын
Is C# code built with configuration of Release or Debug mode. I can not see that.
@AntonPutra
@AntonPutra 5 ай бұрын
release, i also got AOT verion will be testing soon
@kolebynov
@kolebynov 4 ай бұрын
@@AntonPutra Did you really use Release mode? I checked Dockerfiles in your repo and I see that you use dotnet publish command without -c Release parameter. dotnet publish command builds app in Debug mode by default. Edit: I rechecked, since .NET 8, publish uses Release by default, so it seems everything is ok.
@sulaimantriarjo8097
@sulaimantriarjo8097 5 ай бұрын
is there any explaining why C# tends to failing when request is high?
@RaZziaN1
@RaZziaN1 5 ай бұрын
could be default seetings, max thread pool, threads starvation, db connections, pretty much some default configuration issue ?!? pretty much anything
@AntonPutra
@AntonPutra 5 ай бұрын
I'm curious too and am trying to add more metrics for the next tests, maybe even open file descriptors, etc. - github.com/google/cadvisor/blob/master/docs/storage/prometheus.md
@AntonPutra
@AntonPutra 5 ай бұрын
adding more metrics for the next tests...
@m0n0x41d
@m0n0x41d Ай бұрын
Шарп в AOT скомпилить и потом размеры контейнеров сравнить, не?
@UnniMana
@UnniMana 5 ай бұрын
Your videos are very interesting ... Keep doing it. I have one question. Is it possible for you to create videos for gin, fiber and echo frameworks? thank you
@AntonPutra
@AntonPutra 5 ай бұрын
thanks you! i'll see what i can do and when
@03shyam
@03shyam 5 ай бұрын
Could you do a performance comparison between Rust Actix and Golang GoMicro? Thank you.
@AntonPutra
@AntonPutra 5 ай бұрын
Well, I just finished testing Rust Actix with Fiber in EKS and will upload in a couple of days. Why GoMicro? Anything special about that framework?
@wudewang9947
@wudewang9947 5 ай бұрын
In test 1, in C# , the json serialization can a improve by setting the context
@AntonPutra
@AntonPutra 5 ай бұрын
noted! i'll try next time when i prepare a test with c#
@billn98
@billn98 5 ай бұрын
Really cool benchmark. Can you do Dart Serverpod vs Go Gin too?
@AntonPutra
@AntonPutra 5 ай бұрын
Gin? It's kind of slow, and I've already tested it. Maybe Fiber or standard library?
@billn98
@billn98 5 ай бұрын
@@AntonPutra because Dart serverpod is new framework, and we wanna see how it compares against popular alternative like Gin. Comparing it with Fiber or std I think is useless, because we already know that they are too fast :).
@AntonPutra
@AntonPutra 5 ай бұрын
@@billn98 noted
@julioleal2143
@julioleal2143 5 ай бұрын
Hi there! Nice video, Thanks!!! Would be possible to do the same test, but using Java instead of .NET ? Maybe also Java x .NET as well 🙂🙂
@AntonPutra
@AntonPutra 5 ай бұрын
thank you! noted!
@markhenderson5283
@markhenderson5283 5 ай бұрын
It's really not surprising that go would be faster and use less memory than .Net which has a big runtime. Enterprises use .Net over things like golang to cut development time. Two things I'd like to see .Net AOT vs .Net (no AOT) and .Net (AOT and not) vs Java. Also with AOT it should be possible to use something like an alpine linux image with no .net runtime installed.
@Sam-gd4xp
@Sam-gd4xp 5 ай бұрын
AOT will not help you with performance. LOL And that is quite optimisation, so Go lang can also use more optimisation switches. And.... Go lang would be faster ;) Well we all knew that C# is fazing out, OOP and Functional rulset is to much of a heavy load that is slowing down .Net execution. It is becoming relic of the past. Did you knew that C# is trying to solve boiler plate coding. And because of that, language has over 100 reserved language words and compiler and compiler tokenizer needs to work hard and be compicated. Java and Go lang use around 50 reserved language keywords and have more solid priciples that .Net (C#). Sometimes C# can solve simple value addresing in 5 to 10 syntactical ways. Java and Go lang only in 2 to 3 syntactical ways, which is enough.
@MaximT
@MaximT 5 ай бұрын
@@Sam-gd4xp but Rust is much faster than go. C# is by other more fair tests is very close to go
@AntonPutra
@AntonPutra 5 ай бұрын
I'll definitely test AOT, and if it makes sense I'll make a video
@markhenderson5283
@markhenderson5283 5 ай бұрын
@@AntonPutra I'd watch it if you did make that video. It would be very interesting to see how much overhead or not is removed by compiling the whole app ahead of time and eliminating the runtime. Java has jaotc but I don't know if it ever left the experimental phase. Android has had ART for several years, which is also an ahead of time compiler. AOT must do something significant given where it is used today.
@PanicAtProduction
@PanicAtProduction 5 ай бұрын
Good job
@AntonPutra
@AntonPutra 5 ай бұрын
thanks!!
@salman2070
@salman2070 5 ай бұрын
very interesting
@AntonPutra
@AntonPutra 5 ай бұрын
thanks..
@nightmarenova6748
@nightmarenova6748 5 ай бұрын
What specs do each of the nodes have and the controllers ?
@AntonPutra
@AntonPutra 5 ай бұрын
4 CPUs and 8 GB of memory. From now on, I'm only testing apps in production-ready EKS clusters to make it similar to what we actually run in production environments. I use m6a.2xlarge EC2 instances for the nodes...
@OlegMongol18675
@OlegMongol18675 3 ай бұрын
Стремлюсь к такому же инглишу(без прикола). Каждое слово отдельное и понятное. Даже я понял всё сразу
@timur2887
@timur2887 3 ай бұрын
ну ты можешь написать текст на русском, перевести его, а потом зачитать)
.net7 C# vs Golang. Сравнение производительности
16:13
Архитектор ПО. Александр Желнин
Рет қаралды 9 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Deno vs. Node.js vs. Bun: Performance Comparison 2025
8:54
Anton Putra
Рет қаралды 9 М.
Forget Controllers and Minimal APIs in .NET!
14:07
Nick Chapsas
Рет қаралды 82 М.
FastAPI vs Go (Golang) vs Node.js: Performance & Price
13:12
Anton Putra
Рет қаралды 54 М.
Transformers (how LLMs work) explained visually | DL5
27:14
3Blue1Brown
Рет қаралды 4,6 МЛН
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 271 М.
Rob Pike: What Golang Got Right & Wrong
29:23
ThePrimeTime
Рет қаралды 161 М.
10 Signs Your Software Project Is Heading For FAILURE
17:59
Continuous Delivery
Рет қаралды 41 М.