# Directio not working

**URL:** <https://www.ruby-forum.com/t/directio-not-working/208344>\
**Category:** NGINX\
**Created:** [June 15, 2011, 6:37pm UTC](https://www.ruby-forum.com/t/directio-not-working/208344 "2011-06-15T18:37:25Z")\
**Posts on this page:** 2\
**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:** [June 15, 2011, 6:37pm UTC](https://www.ruby-forum.com/t/directio-not-working/208344/1 "2011-06-15T18:37:25Z")

</div>

Hi, from nginx wiki:

directio  
syntax: directio [size|off]  
default: directio off  
context: http, server, location  
The directive enables use of flags O\_DIRECT (FreeBSD, Linux), F\_NOCACHE  
(Mac OS X) or directio() function (Solaris) for reading files with size  
greater than specified. This directive disables use of  
sendfile[http://wiki.nginx.org/HttpCoreModule#sendfile](http://wiki.nginx.org/HttpCoreModule#sendfile) for this  
request. This directive may be useful for big files:  
directio 4m;

I have in my config:  
directio 0;

(I do not want to cache anything in ram)

But ater 5 mins of nginx running:

free -m  
total used free shared buffers  
cached  
Mem: 7994 1980 6014 0 255  
1033  
-/+ buffers/cache: 691 7303

(cached is going up and up)

Is something else needed or is it just not working?

OS:  
2.6.35-28-generic #50-Ubuntu SMP Fri Mar 18 18:42:20 UTC 2011 x86\_64  
GNU/Linux

Many thanks as always

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 15, 2011, 8:35pm UTC](https://www.ruby-forum.com/t/directio-not-working/208344/2 "2011-06-15T20:35:29Z")

</div>

Hi,

This directive just sets when to use direct IO and when not to, it does  
not affect the Nginx output buffers which are used when sendfile is  
turned off.

Similarly, the cached value you see in free -m is the amount your OS use  
for caching IO, not nginx. If you wish to turn this off you must do so  
at the OS level.

Posted at Nginx Forum:

> **[Re: directio not working](https://forum.nginx.org/read.php?2,207213,207247#msg-207247)**
>
> Hi, from nginx wiki: directio syntax: directio \[size|off\] default: directio off context: http, server, location The directive enables use of flags O\_DIRECT (FreeBSD, Linux), F\_NOCACHE (Mac OS X) or directio() function (Solaris) for reading files with...
