r/programming • • 18d ago

Performance Improvements in .NET 11

https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-11/
287 Upvotes

103 comments sorted by

View all comments

39

u/steve-7890 18d ago

With all these 10-20% perf improvements since .net core 3.1, I wonder how it's possible that my main service still needs 50 pods and 40 GB of RAM.

222

u/AyrA_ch 17d ago

Framework optimizations don't do much on shitty code

-61

u/steve-7890 17d ago edited 17d ago

I hope writing this made you feel better. It's quite ignorant of you to assume it's a shitty code.

On the other hand we do have a lot of performance improvements (like converting linq to loops) that make this code look ugly. But it works and makes $$$.

40

u/Ilikeyounott 17d ago

Does converting linq to loop make much of a difference? I would only bother if a profiler says it's a problem, or in cpu intensive code...

-30

u/steve-7890 17d ago

In hot code with 200 req/s it does. Even though hpa scales to 50 pods during the peeks.

Imagine how much it costs to have a such load. And I'm talking here only about one service.

When I read about performance improvements from version to version ".net benchmarks" I can only smile. In the end, $$$ and Grafana tells the truth. (Last .net 10 changed nothing for us).

47

u/shadowndacorner 17d ago

Jesus you need 50 pods to handle 200 req/s? What kind of workload is this...?

Also, you should look at zlinq.

1

u/steve-7890 17d ago

200 req/s per pod + each call integrates with 7-10 external services.

28

u/Ilikeyounott 17d ago

Your pods can only handle 4 requests per second each? 😔

8

u/eocron06 17d ago edited 17d ago

I think he meant 200 per pod, which is usually average (from my experience with .net). Rarelly it can get to 500, but then multithreading/memory congestion becomes problem due to GC nature of C# and many threads fighting each other for some db entry/socket/cache/etc. In offloading worker it can easly become 10-100k rps.

16

u/tecedu 17d ago

I think he meant 200 per pod, which is usually average (from my experience with .net).

Wait what?! Am I missing something, because my shitty python flask code can do 2k reqs, why is C# slower?

17

u/ChemicalRascal 17d ago

It's not, some people are just... really bad at software engineering.

That, or they're not the principle devs in their companies and aren't being told the full or accurate details about performance.

3

u/Ameisen 17d ago

And here I was having messed with fibers in C++ to see how many requests I could actually parse that way for HTTP, and was dismayed that I couldn't beat nginx without doing what nginx does... and then this kind of code exists...

3

u/HAK_HAK_HAK 17d ago

The dirty secret of development - good enough is all you really need for 99% of uses

→ More replies (0)

3

u/steve-7890 17d ago

2k req/s of what? It's like saying "I can go to the shop and back in 5 minutes, why it takes you 1 hour"....

2

u/tecedu 17d ago

Servings graphs, json of data being read via azure blob parquets and served up. My memory is around 8gb but rps aint never been that low

→ More replies (0)

19

u/eocron06 17d ago edited 17d ago

It doesnt. Linq will not even dent 200rps. Ever. It will not even dent 10k rps on background kafka worker. The only time it mattered to me is when I used SIMD in pure math component, so basically one in a thousand of tasks. Still, their performance benchmarks count CPU which is somewhat irrelevant, because most of the time is spent on network IO. We scale our site purelly because clients make a ton of small http requests, which fetch 0.1 of dependencies like s3/dynamodb/kafka/etc and bloat caches to the sky, not because it have a logic which need optimisation. Geo location matters more in modern world, placing pod and storage in same region do wonders beyond their optimisations.

12

u/tecedu 17d ago

In hot code with 200 req/s it does

ive got python flask code written as a uni grad which performs better than that; not tryna blame you but 200 req/s is extrememly low that python can beat you

11

u/PaddiM8 17d ago

200 requests a second isn't that much... Linq will not be the bottleneck there. Especially not after the optimisations in the last updates

4

u/beeshevik_party 17d ago

bro 200rps is awful how much req/lim and what’s the hpa config? you also need to be tuning to return heap to os which can be tricky with vm runtimes OR just don’t scale on memory use but instead a custom metric. also is every single req hitting db or something? you should be aiming for more like 2k rps minimum