发信人: zhcharles(小传 -> 寻)
整理人: qiaoqian(2002-10-15 20:20:44), 站内信件
|
ReiserFS tuning for Qmail
For each queued message, Qmail creates some files and links :
A file with the message data.
A tiny file with the envelope.
Various links to atomically move messages from one state to another.
So, a Qmail queue (/var/qmail/queue) often contains a lot of small files. These files are always moved from one directory to another, and they disappear as soon as they are properly delivered to all recipients.
Mail delivered to local users can be stored in a single file (mailbox) or a directory tree, one file per message (maildir) .
--------------------------------------------------------------------------------
Here is how to format and mount your ReiserFS partitions to achieve the best performances :
If possible, have a fast hard disk for the queue, and other disks for local users.
Format the queue disk with R5 hash.
Mount the queue disk without access time update. It is useless for the Qmail queue and reduces performances. You should modify your /etc/fstab file to get a line like this :
/dev/hdb1 /var/qmail/queue reiserfs defaults,noatime,nodiratime 0 0
Unless you experiment severe delivery problems, the queue should be small. So if you have plenty of free space on your queue partition, also suppress tails. The previous sample becomes :
/dev/hdb1 /var/qmail/queue reiserfs defaults,noatime,nodiratime,notail 0 0
If you use maildirs, don't use Rupasov hash for the partition holding user mail directories. If you feel paranoid, use TEA hash, but R5 is known to work fast and flawlessly. To format a partition with R5 hash, use a command like :
mkreiserfs -h r5 /dev/hda2
If you use IDE drives, try to tweak them with hdparm. Enable DMA (-d 1), disable interrupts masking (-u 1), enable 32 bits access (-c 3), set multiple sector count (-m 16 work fine with most modern drives, but you can use -i to find the highest value your drive may support) . If your drive and your controler support Ultra DMA 2, add -X 66. If you think your BIOS is broken, also add -p to autodetect the best PIO mode.
Write-caching issues : many modern drives support write-caching. Sometimes, enabling it may be a huge performance win, especially when you have many concurrent disk writes like what Qmail does. The problem is that the ReiserFS journal has to be written synchronously for a proper replay at bootup time. At least, everything written to it should be here after a system shutdown or a crash. In fact, there is only a problem in case of a power failure. The write cache is in the disk itself, and if you got a kernel crash, data will still be written later. So, the following trick looks like a dirty hack but may help a lot with some drives. If you have an UPS, enable write caching by default, and configure your UPS daemon to automatically disable write caching when a power failure occurs.
FYI, this text is written on a Sony Vaio PCG-Z600RE laptop whose hard disk I/O is twice faster after the following command :
/sbin/hdparm -m 16 -p -W 1 -u 1 -c 3 -d 1 -X 66 /dev/hda
----
Hand in hand with you , grow older together !
执子之手,与子皆老!
|
|