Dawid Pereira’s Post

View profile for Dawid Pereira

Problem-Solving Engineer | .NET Craftsman | Rust Explorer | DDD & System Design Expert | Technical Speaker & Mentor

𝗧𝗵𝗶𝘀 𝗮𝘀𝘆𝗻𝗰 𝗰𝗼𝗱𝗲 𝗶𝘀 𝗰𝗼𝘀𝘁𝗶𝗻𝗴 𝘆𝗼𝘂 𝘁𝗵𝗼𝘂𝘀𝗮𝗻𝗱𝘀 Async/await has been in .NET for over a decade, yet production systems still suffer from the same three mistakes that destroy performance and inflate cloud costs. These patterns appear innocent. Code reviews approve them. They pass all tests. But under load, they become system killers. The symptoms are always the same: → Thread pool starvation with low CPU usage → Random deadlocks in production → Response times growing exponentially with load → Cloud costs mysteriously tripling The most dangerous part? Standard monitoring often shows the system as "healthy" with 20% CPU usage. The problem isn't CPU - it's thread exhaustion. Each blocking call consumes a thread. With default thread pool settings, just 100 concurrent requests can bring an API to its knees. Async void swallows exceptions, causing silent failures that only surface during peak traffic. Unnecessary Task.Run calls double thread usage for zero benefit. These aren't edge cases. They're in most codebases right now, waiting for the next traffic spike. 𝗧𝗼𝗺𝗼𝗿𝗿𝗼𝘄: The fixes that enable 100x throughput improvements with the same infrastructure. 𝗛𝗮𝘃𝗲 𝘆𝗼𝘂 𝘀𝗲𝗲𝗻 𝘁𝗵𝗲𝘀𝗲 𝗽𝗮𝘁𝘁𝗲𝗿𝗻𝘀 𝗶𝗻 𝘆𝗼𝘂𝗿 𝗰𝗼𝗱𝗲𝗯𝗮𝘀𝗲? Did you noticed potential issue in mistake 2? #AsyncAwait #Dotnet #CSharp #PerformanceOptimization #SoftwareEngineering

  • text
Dawid Pereira

Problem-Solving Engineer | .NET Craftsman | Rust Explorer | DDD & System Design Expert | Technical Speaker & Mentor

2mo
Anton Martyniuk

Helping 60K+ Developers Improve .NET Skills and Craft Better Software | Microsoft MVP | Technical Lead

2mo

Evil in async code: - async voide - using .Result or GetAwaiter().GetResult() - mixing Thred.Sleep with async code - not using CancellationToken

Kanaiya Katarmal

Helping 29K+ Engineers with .NET | CTO | Software Architect | I Help Developers & Startups Turn Ideas into Scalable Software ��� | Weekly .NET Tips

2mo

 async looks simple but the traps are everywhere., Dawid Pereira In mistake #2 (async void), isn’t the bigger issue that exceptions get swallowed, making debugging almost impossible?

Who calls Result or GetAwaiter() ? Not many people i have seen

Siddhartha S

Application Architect | 18+ Yrs in Capital Markets | Scalable, Low Latency Systems | .NET, Kafka, AWS | Ex-Morgan Stanley

2mo

Yes! Mistake 2 is likely using async void, which swallows exceptions and makes failures silent. This can cause deadlocks and unpredictable behavior under load.

SERKUT YILDIRIM

Senior Software Developer | Microsoft MVP | Follow for C# .NET, Java and Software Tips!

2mo

Nice tip. Properly scheduling I/O-bound tasks lets your thread pool grow only when needed, keeping your app snappy under heavy load without extra costs

Fatima Azam

Software Engineer | .Net | .Net core | Microservices | Azure | Angular | React | Unit Testing

2mo

This hits hard async/await isn't just about syntax; misuse silently cripples performance and budgets. Thread exhaustion hides in plain sight while your system "looks healthy." Time to audit that async code.

Ishan Goel

Tech Lead | .NET Core | SQL | Solution Architect | Performance Tuning | Secure Solutions | Learner & Tech Insights

2mo

Well put—these patterns often sneak past reviews and testing but show their real cost under load. Faced them myself, and debugging isn’t straightforward. Would be interesting to see your implementation of the fixes. Dawid Pereira

For the 2nd, there is no way of waiting for an async void method to complete.

See more comments

To view or add a comment, sign in

Explore content categories