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

preview_player
Показать описание
Go (Golang) vs C# performance benchmark.

▬▬▬▬▬ Experience & Location 💼 ▬▬▬▬▬
► I’m a Senior Software Engineer at Juniper Networks (12+ years of experience)
► Located in San Francisco Bay Area, CA (US citizen)

▬▬▬▬▬▬ Connect with me 👋 ▬▬▬▬▬▬

▬▬▬▬▬▬▬ Timestamps ⏰ ▬▬▬▬▬▬▬
0:00 Intro
1:27 .Net Overview
2:16 Golang Overview
2:43 1st Test Diagram
3:52 2nd Test Diagram
5:11 Image Size
6:07 Startup time
7:13 1st Test
11:28 2nd Test

▬▬▬▬▬▬▬ Source Code 📚 ▬▬▬▬▬▬▬

#golang #csharp #kubernetes
Рекомендации по теме
Комментарии
Автор

.NET should not be dropping requests whole using so little CPU. Something about the setup is wrong here.

Dr-Zed
Автор

I like these real world test scenarios. And I love that you increased RPS until failure. Please keep doing that with every benchmark

__Michu__
Автор

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.

Denominus
Автор

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.

anhcoder
Автор

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

3. Try increasing the minimal number of threads:
ThreadPool.GetMinThreads(out _, out int completionPortThreads);
ThreadPool.SetMinThreads(100, completionPortThreads);

yurii
Автор

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

paarma
Автор

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.

cheukmingau
Автор

Use native aot for C#. Memory usage will be way less, and startup time will be very fast

zhh
Автор

Congrats you got new subs!!
Love with your test, please add more C# comparison

pandhuprisnawan
Автор

I don’t understand why both start dropping request while cpu usage is nowhere near 100 and memory usage is less than 50%

zephyrprime
Автор

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?

TweakMDS
Автор

You have found some kind of holy grail of programming content for Youtube 😄 Very addictive videos -> I subscribed

jaans
Автор

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.

mmacgearailt
Автор

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

RobinVeldhuis
Автор

I like this kind of content, you've got one more subscriber! 😊

Cuca-hnmd
Автор

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.

lczago
Автор

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.

MagicNumberArg
Автор

Thanks for the thorough test! Why do you use .NET 6 while the latest LTS version is .NET 8 ?

korzhs
Автор

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

lukavranes
Автор

Excellent test & very thorough....thanks.

RockTheCage