分类: 系统运维
2005-05-24 20:09:30
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:
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