Reduce disk I/O for small reads using memory

Many applications that are used on a standard server perform quite a few of small writes to the disk (like MySQL or Apache). These writes can pile up and limit the performance of your applications. If you have kernel 2.6.9 or later, you can adjust how these small writes are handled to allow for better performance. There’s two main kernel variables to know: vm.dirty_ratio - The highest % of your memory that can be used to hold dirty data....

2008-08-07 · 2 min · Major Hayden

Reduce iowait in Plesk: put qmail’s queue on a ramdisk

I really dislike qmail. But, since I use Plesk, I’m stuck with it. However, I found a way to improve it’s awful mail queue performance by putting the mail queue onto a ramdisk. This is actually pretty darned easy to do. First, toss a line like this into your /etc/fstab: none /mailqueue tmpfs defaults,size=100m,nr_inodes=999k,mode=775 0 0 This will make a 100MB ramdisk on /mailqueue. Now, just symlink /var/qmail/mqueue to /mailqueue and move your e-mail over:...

2008-03-14 · 1 min · Major Hayden

Hunting down elusive sources of iowait

A question I’m asked daily is “How can I find out what is generating iowait on my server?” Sure, you can dig through pages of lsof output, restart services, or run strace, but it can be a frustrating process. I saw a process on this blog post, and I changed the regexes to fit Red Hat and CentOS systems a bit better: # /etc/init.d/syslog stop # echo 1 > /proc/sys/vm/block_dump # dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head 1526 mysqld 819 httpd 429 kjournald 35 qmail 27 in 7 imapd 6 irqbalance 5 pop 4 pdflush 3 spamc In my specific situation, it looks like MySQL is the biggest abuser of my disk, followed by Apache and the filesystem journaling....

2008-03-11 · 1 min · Major Hayden

High iowait on RHEL 4 with Plesk and SpamAssassin

One of my biggest complaints on RHEL 4 is the large resource usage by the version of SpamAssassin that is installed. When it runs, it uses a ton of CPU time and causes a lot of disk I/O as well. When running top, you may see multiple spamd processes. For a high-volume e-mail server (like the one I administer), this is simply unacceptable. I decided to do something about it, and here are the steps:...

2008-01-31 · 2 min · Major Hayden