2 ms·
Isn't the use or non-use of async/await a bit orthogonal to the rest of this? I'm not an expert in this area, but wouldn't it be just as lightweight to have yo
by mikepurvis 6y ago
Isn't the use or non-use of async/await a bit orthogonal to the rest of this?
I'm not an expert in this area, but wouldn't it be just as lightweight to have your async workers pushing onto a queue, and then have your async writer only wake up when the queue is at a certain level to create the batched write? Either way, you won't be paying the OS context switching costs associated with blocking a write thread, which I think is most of what you're trying to get out of here.
- pbalcer 6y agoRight, I agree. I'd go even further and say that async/await is a great fit for a modern asynchronous I/O stack (not read()/write()). Especially with io_uring using polled I/O (the worker thread is in the kernel, all the async runtime has to do is check for completion periodically), or with SPDK if you spin up your own I/O worker thread(s) like @benlwalker explained elsewhere in the thread.