Skip to main content

New answers tagged

0 votes

Purpose of async/await in web servers

Its not about CPU work, the async stuff is not for processing. Its for IO. Once you realise that, it becomes a little easier to accept. Its still pointless rubbish though as the async version of IO ...
gbjbaanb's user avatar
  • 48.6k
1 vote

Purpose of async/await in web servers when stuck with legacy I/O

If your application consists only of CPU intensive tasks or legacy blocking calls, there's little advantage in hosting them in an asynchronous environment. Doing so only adds a layer of abstraction. ...
Cort Ammon's user avatar
  • 11.6k
0 votes

Purpose of async/await in web servers when stuck with legacy I/O

As JonasH pointed out, there is no performance advantage (IN A WEB SERVER) to wrap synchronous logic in an async wrapper. ※For things like GUI based apps, you may want to move to a separate thread to ...
Mars's user avatar
  • 273
1 vote

Purpose of async/await in web servers when stuck with legacy I/O

There is no problem returning Task from a method, even if nothing async happens inside (other than potentially violating KISS). This is what Task.CompletedTask is for. Remember, any method marked &...
Ccm's user avatar
  • 2,084
2 votes

Purpose of async/await in web servers when stuck with legacy I/O

The devil is in the details. Simply saying "I use sync i/o" or "I have cpu-intensive computations" doesn't say much. For example, I might have a separate threads or threadpool ...
freakish's user avatar
  • 1,459
5 votes

Purpose of async/await in web servers when stuck with legacy I/O

This is known as "async over sync" and is generally considered an anti pattern. If your IO is still synchronous you will have a blocked thread, so there is no scalability benefit to wrapping ...
JonasH's user avatar
  • 5,724
9 votes

Purpose of async/await in web servers

It sounds to me like there are 2 wrong assumptions here. The point of async/await isn't to free up the socket/connection. You're freeing up the thread to do other work during some async operation. ...
Mars's user avatar
  • 273
50 votes
Accepted

Purpose of async/await in web servers

As far as I can tell, every request is already being run on a thread pool (as empirically tested by logging the thread ID during each request), so making all calls use async/await within your ...
Ccm's user avatar
  • 2,084
12 votes

Purpose of async/await in web servers

A threadpool does not have infinite threads. Each time you synchronously wait, you are holding onto a thread and doing nothing with it. If you instead await, the suspension will bubble up to the ...
Caleth's user avatar
  • 11.4k

Top 50 recent answers are included