[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Performance hit: symlinks



on Mon, Feb 17, 2003 at 10:18:46AM +0100, Jeff Elkins (jeffelkins@earthlink.net) wrote:
> Is there one, or if so is it perceptible?  For instance, I compiled kde and qt 
> to live in /opt. If I moved /opt to /usr/local/kde31 and made /opt a symlink 
> would this create overhead a human would notice?

    $ ls -l /lib /usr/lib

You'll find that *every* (almost) system library is implemented as a
symlink.

The reason for this[1] is that creating or modifying a symlink is an
atomic operation.  Deleting and creating a file is two separate
operations.  If you're updating the library that's used by the function
you're using to update the library, you're sort of stuck.

By using symlinks, filehandle open to the old library will continue to
work while they are open.  The atomicity of the operation means that the
link replacement occurs under the old library until the link operation
is completed.

And as far as performance -- this means that *every single dynamically
linked exeutable on your system is accessing multiple symbolic links
when it starts up*.  The overhead is assuredly minimal.

This system for creating and updating system libraries is common to most
Unices, not just GNU/Linux.

This fact didn't stop a clueless boss of mine many many moons ago from
forbidding use of symlinks in a data warehouse organization scheme....
The fact that he's now working for a major Unix vendor is...ironic.

Peace.


--------------------
Notes:

1.   I know I'm butchering this somewhat.  Corrections appreciated.


-- 
Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
   Moderator, Free Software Law Discussion mailing list:
     http://lists.alt.org/mailman/listinfo/fsl-discuss/



Reply to: