Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I tried to find an existing question for this already, but couldn't find a good match.

As part of my deploy process for my public facing sites, I am using symlinks to swap between versions of the web application.

For instance, I have a vhost abc.com which has a docroot here: /var/www/abc.com

The docroot itself (/var/www/abc.com) is a symlink to the application's web-accesible directory (/var/www/package/buildX/web)

When I deploy a new build, I simply swap out the symlink and replace with another symlink to the new build.

The question I have is, what is the performance overhead (or concerns I should have) with using symlinks for an Apache docroot

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The first issue is, are all of these files in the same filesystem or physical storage device? If so, the difference between a direct reference and a symlink will be nearly impossible to detect.

You need to think in orders of magnitude here. Your application is probably underpinned by a scripting language and a database. Those elements of the application will be the limiting factor, not a minor filesystem feature. Jeff Atwood explains this best in this blog post.

share|improve this answer
    
thanks Joel! and thanks for the link! –  chadl Mar 15 '12 at 18:44
add comment

Don't worry about symlink performance hit. Practically everything else will be a bottleneck before that one. Resolving a symlink does not take too many CPU cycles; running your PHP script, handling the database queries and result sets, possibly using modules like Apache's mod_security will be the real bottle neck.

In theory you could optimize something if everything your server serves is static content; even then, tuning the web server and/or kernel parameters and scaling the hardware is the right thing to do, not silly micro-optimization such as dealing with symlinks. Symbolic links provide you a clean and convenient way to switch between web site version etc; use them happily.

share|improve this answer
    
thanks for the great response Janne! Your response is (IMO) equally as good as Joel's response. However, Joel's response was both earlier, and referenced a great blog post. I will be accepting his response as a result. Thanks! –  chadl Mar 15 '12 at 18:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.