# Aio vs non-blocking-io

**URL:** <https://www.ruby-forum.com/t/aio-vs-non-blocking-io/214763>\
**Category:** NGINX\
**Created:** [December 12, 2011, 12:59am UTC](https://www.ruby-forum.com/t/aio-vs-non-blocking-io/214763 "2011-12-12T00:59:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [December 12, 2011, 12:59am UTC](https://www.ruby-forum.com/t/aio-vs-non-blocking-io/214763/1 "2011-12-12T00:59:34Z")

</div>

Hello,

Is there a chance to use non-blocking-io with nginx?  
AIO is quite broken on Linux, but “O\_NONBLOCK” is not.  
I know, AIO would be better because you don’t have to wait  
until the buffer is copied to the kernel-space, but what should  
we do…

The problem, nginx is quite often in “uninterruptible sleep” (D),  
so the whole process is blocked.

Thanks a lot  
Marcus

Posted at Nginx Forum:

> **[aio vs non-blocking-io](https://forum.nginx.org/read.php?2,219886,219886#msg-219886)**
>
> Hello, Is there a chance to use non-blocking-io with nginx? AIO is quite broken on Linux, but "O\_NONBLOCK" is not. I know, AIO would be better because you don't have to wait until the buffer is copied to the kernel-space, but what should we...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 12, 2011, 1:02am UTC](https://www.ruby-forum.com/t/aio-vs-non-blocking-io/214763/2 "2011-12-12T01:02:39Z")

</div>

Hi,

> I know, AIO would be better because you don’t have to wait  
> until the buffer is copied to the kernel-space, but what should  
> we do…

Move away from Linux.

Best regards,  
Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 12, 2011, 11:09am UTC](https://www.ruby-forum.com/t/aio-vs-non-blocking-io/214763/3 "2011-12-12T11:09:42Z")

</div>

Hello!

On Sun, Dec 11, 2011 at 06:58:57PM -0500, double wrote:

> Is there a chance to use non-blocking-io with nginx?  
> AIO is quite broken on Linux, but “O\_NONBLOCK” is not.

Does O\_NONBLOCK works on Linux for regular files? If yes, where  
is sematics defined?

POSIX says behaviour of O\_NONBLOCK on regular files is  
unspecified, and it’s indeed impossible to use O\_NONBLOCK on  
regular files with POSIX interfaces: there is no way to schedule  
read operation and there is no way to find out if I/O possible  
(select()/poll() always return regular files as ready for  
reading/writing as per POSIX).

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 12, 2011, 11:23am UTC](https://www.ruby-forum.com/t/aio-vs-non-blocking-io/214763/4 "2011-12-12T11:23:25Z")

</div>

On 12/12/2011 02:02 AM, Piotr S. wrote:

> Hi,
> 
> > I know, AIO would be better because you don’t have to wait  
> > until the buffer is copied to the kernel-space, but what should  
> > we do…
> 
> Move away from Linux.

Does nginx provide better performance under other operating systems?
