No, but really. It depends on the kind of workload you have.
Async are really great for backend work if you have the kind of workload that are suitable for it. In particular, if your workload is mostly: receive request, do small processing, then hand it off to another backend service like a database or another API server, and those backend processing are takes time, then async can be very beneficial since you wouldn't have to configure the server to have lots of workers to saturate your CPU. Basically, if your workload is mostly that your process is waiting for other things to happen rather than actively doing work, and you need to hold a large number of users concurrently, then you should consider async. Only async process can handle 5000 concurrent requests at the same time and not end up with the CPU thrashing, and ridiculous load average.
But they're not a silver bullet for performance. async solve a particular problem that many people have in server side programming, that doesn't really have a good solution in sync code.
Another very common use case is handling web sockets. In this case, you'll have 10000 users creating a connection and then mostly idling until you have an event that happens occasionally for individual users, but collectively they can load up the whole server.
0
u/[deleted] Dec 01 '22
[deleted]