[EN] Optimizing Apache server - IO WAIT - Symlinks

Rate this Entry
Based on
FollowSymLinks and SymLinksIfOwnerMatch

Wherever in your URL-space you do not have an Options FollowSymLinks, or you do have an Options SymLinksIfOwnerMatch Apache will have to issue extra system calls to check up on symlinks. One extra call per filename component. For example, if you had:
DocumentRoot /www/htdocs

Options SymLinksIfOwnerMatch

and a request is made for the URI /index.html. Then Apache will perform lstat(2) on /www, /www/htdocs, and /www/htdocs/index.html. The results of these lstats are never cached, so they will occur on every single request. If you really desire the symlinks security checking you can do something like this:
DocumentRoot /www/htdocs

Options FollowSymLinks

Options -FollowSymLinks +SymLinksIfOwnerMatch
This at least avoids the extra checks for the DocumentRoot path. Note that you'll need to add similar sections if you have any Alias or RewriteRule paths outside of your document root. For highest performance, and no symlink protection, set FollowSymLinks everywhere, and never set SymLinksIfOwnerMatch.
I was using symlinks... a lot of them actually. I moved all in one big directory which is the DocumentRoot now. IO wait is 0% now, but there is also not much traffic on the server. I will monitor and come back with details.