4 ms·
Thought nginx epolls file i/o too along side socket i/o. Or did you find that the first call to open() or stat() stalls, while read/write after that continues n
by habibur 4y ago
Thought nginx epolls file i/o too along side socket i/o. Or did you find that the first call to open() or stat() stalls, while read/write after that continues normally?
- Matthias247 4y agoFile IO isn’t epoll-able. The operations are always blocking. Those could however be offloaded onto a threadpool, to avoid the blocking to affect any other requests that are processed by the same Nginx worker. Nginx however only partially does that - whole file read and write operations are offloaded a whole bunch of other IO (stat, open, close) are executed on the main thread. I guess due to implementation challenges - one can’t just make one operation async but also needs to make each operation that utilizes those methods async.
- habibur 4y agoSearched nginx source. Seems like it's using aio_read() aio_write() ./src/os/unix/ngx_file_aio_read.c API's doc https://man7.org/linux/man-pages/man3/aio_read.3.html https://man7.org/linux/man-pages/man3/aio_read.3.html Even though the source is there don't mean it's compiled or used though. Might or might not be. No idea about the details.