8.2 Filesystem Tuning Options

 <  Day Day Up  >  

First of all, you should never use RAID for Squid cache directories. In my experience, RAID always degrades filesystem performance for Squid. It is much better to have a number of separate filesystems, each dedicated to a single disk drive.

I have found four simple ways to improve UFS performance for Squid. Some of these are specific to certain operating systems, such as BSD and Linux, and may not be available on your platform:

  • Some UFS implementations support a noatime mount option. Filesystems mounted with noatime don't update the inode access time value for reads. The easiest way to use this option is to add it to the /etc/fstab like this:

     # Device            Mountpoint    FStype  Options        Dump    Pass# /dev/ad1s1c         /cache0       ufs     rw,noatime     0       0 
  • Check your mount(8) manpage for the async option. With this option set, certain I/O operations (such as directory updates) may be performed asynchronously. The documentation for some systems notes that it is a dangerous flag. Should your system crash, you may lose the entire filesystem. For many installations, the performance improvement is worth the risk. You should use this option only if you don't mind losing the contents of your entire cache. If the cached data is very valuable , the async option is probably not for you.

  • BSD has a feature called soft updates . Soft updates are BSD's alternative to journaling filesystems. [1] On FreeBSD, you can enable this option on an unmounted filesystem with the tunefs command:

    [1] For further information, please see "Soft Updates: A Technique for Eliminating Most Synchronous Writes in the Fast File System" by Marshall Kirk McKusik and Gregory R. Ganger. Proceedings of the 1999 USENIX Annual Technical Conference, June 6-11, 1999, Monterey, California.

     # umount /cache0 # tunefs -n enable /cache0 # mount /cache0 
  • You only have to run the tunefs once for each filesystem. Soft updates are automatically enabled on the filesystem again when your system reboots.

    On OpenBSD and NetBSD, you can use the softdep mount option:

     # Device            Mountpoint    FStype  Options        Dump    Pass# /dev/sd0f           /usr          ffs     rw,softdep     1       2 

If you're like me, you're probably wondering what the difference is between the async option and soft updates. One important difference is that soft update code has been designed to maintain filesystem consistency in the event of a system crash, while the async option has not. This might lead you to conclude that async performs better than soft updates. However, as I show in Appendix D, the opposite is true.

Previously, I mentioned that UFS performance, especially writing, depends on the amount of free space. Disk writes for empty filesystems are much faster than for full ones. This is one reason behind UFS's minfree parameter and space/time optimization tradeoffs. If your cache disks are full and Squid's performance seems bad, try reducing the cache_dir capacity values so that more free space is available. Of course, this reduction in cache size also decreases your hit ratio, but the response time improvement may be worth it. If you're buying the components for a new Squid cache, consider getting much larger disks than you need and using only half the space.

 <  Day Day Up  >  


Squid
Squid: The Definitive Guide
ISBN: 0596001622
EAN: 2147483647
Year: 2004
Pages: 401
Authors: Duane Wessels

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net