|
|
|
|
|
by petrzjunior
823 days ago
|
|
If the async methods return quickly, then yes, there is some overhead. But the point of asynchonous methods is that they can perform slow operations while yielding the calling thread back to the thread pool. For example Alpha might be reading a gigabyte file, Beta is sending it over the network and Gamma waiting for a timer tomorrow. Async/await is a syntactic sugar to run this in a pleasant way. |
|
In fairly extensive tests I found that it is actually pretty rare for threads to be the limiting resource, so async provided no benefit at all.
You pretty much need this specific scenario:
- A large auto-scale pool
- Tuned well to keep load at 80-90%.
- High concurrent connections per instance.
- Slow dependencies that return small volumes of data.
- A much larger back end than the front end. Think 100 VMs at the front and 10K at the back.
Violate any of the above and the benefits seem to evaporate. I’m sure that this scenario is common at FAANG sized orgs, but is extremely rare elsewhere.