I created a .Net Web Api with two controllers that do the same thing (purposefully very slow network calls). One is synchronous and one is asynchronous. You can find the code here: https://github.com/jkruer01/SyncVsAsync
The important difference between the 2 controllers is this single line of code with a WebClient:
Synchronous
var content = client.DownloadString(url);
Asynchronous
var content = await client.DownloadStringTaskAsync(url);
Pretty basic stuff...
Then I created a console app the fires 50 simultaneous requests to either the sync or async controller. I expected the async controller to complete more simultaneous requests but I found the exact opposite to be true. The sync controller completed about 25 out of 50 successfully. The async controller only completed about 10 out of 50 successfully.
Why is this? I thought the purpose of the async code was that it could handle more simultaneous requests.
I'm stumped.