3 ms·
You use async to preserve system resources. For example you can easily exhaust the host with ~20k connections running a thread-per-connection schema where each
by himata4113 4mo ago
You use async to preserve system resources. For example you can easily exhaust the host with ~20k connections running a thread-per-connection schema where each thread simply waits for epoll event, async prevents this by having a threadpool of ~16 threads that handle all the connections instead of polling the scheduler wakes it up, asks "do you haev work to do" if not continues to next task. (This heavily varied by the async runtime implementation, each async runtime can and will act differently to maximize efficiency over throughput)
- bigstrat2003 4mo ago> You use async to preserve system resources. For example you can easily exhaust the host with ~20k connections running a thread-per-connection schema... Sure, if you need to run 20k connections then use async. But the fact of the matter is that the vast majority of software is not going to take on 20k connections. Those people (i.e the majority of software devs) should use threads, because they are much easier to reason about and work with.
- himata4113 4mo agoasync gives you a few other advantages, it allows you to handle bi-streams much easier than two sync threads especially when it comes to synchronization.
- tancop 4mo ago[dead]