Forum Moderators: phranque

Message Too Old, No Replies

Symbolic links

Does the use of symbolic links affect Apache performance?

         

jazzattcs

4:04 pm on May 21, 2010 (gmt 0)

10+ Year Member



I have 2 vhosts on the server: domain.com and static.domain.com. Their docroots are different but static.domain.com uses symbolic links. So /var/www/static.domain.com/images/ is actually a Linux symbolic link to /var/www/domain.com/images/

This is also true for js/ and css/

It works and allows me to keep my application files all in one place under domain.com/. But does this impact Apache performance? Should I use actual files instead of symbolic links? Or is it OK because it's handled by the operating system and not Apache? My understanding of symbolic links in Linux is it's like a pointer in C - it stores the address of the inode or something like that. So it shouldn't affect performance.

jdMorgan

4:21 pm on May 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, the OS has to look up the translation for the symlink, so of course it affects performance -- to a tiny degree, on the order of microseconds on a modern server...

If you have more than fifty lines of code in PHP, PERL, or .htaccess, that will swamp any effect of using a symlink.

I certainly wouldn't duplicate all of those shared files simply to avoid using a few symlinks. If there are a lot of them, then you might be able to replace them with just a few whole-directory Alias directives in your config file, but I'm really not sure which approach would be faster... pretty minor impact either way.

Jim

jazzattcs

4:28 pm on May 21, 2010 (gmt 0)

10+ Year Member



Thanks.
By the way, I figured out the impact of FollowSymLinks. It degrades performance if FollowSymLinks is disabled, because then Apache has has to check every time whether it's a real file or a symlink.

jdMorgan

6:47 pm on May 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you get any hard numbers from benchmarking? Care to share? :)

Jim

jazzattcs

7:18 pm on May 21, 2010 (gmt 0)

10+ Year Member



Wish I had that kind of time to run benchmarking tests. I read this performance thing in some IBM article.