Saturday, September 17, 2005

How to make your mailserver faster ?

My mailserver was very slow when more than 10 users accessing it simultaneously. It uses squirrelmail as the front-end for webmail. As you know (or maybe don't know :P), squirrelmail is built using php and an administrator can extend its functionality via plugins. There's many good plugins to ease administrator's chore and also for users. php on a good side is a very powerful language but it is suffer when it has to open and execute many files. It has to recompile everytime the file is to be executed. This results in slower response because it has to do the same thing over and over again. But thank god I just found the solution. The solution is simple. Everytime the php file is compiled, the resulting binary is used whenever the file is fetched. This results in faster execution time and faster response. The term for this solution is php accelerator. There's many php accelerator out there but the one that gives large boost performance is eaccelerator formerly know as Turck MMCache. It is claimed as the fastest php accelerator out there. For time being I have installed Turck MMCache (the old version of eaccelerator) for I haven't found any Mandrake package of eaccelerator yet. This is what I installed on my mailserver box to make it faster.

1. php accelerator (Turck MMCache)
To speed up php execution.

2. caching-nameserver (BIND 9)
To speed up dns resolution.

3. imapproxy ( -- updated : Sept 20,2005
To speed up connection to imap server by caching it.

4. chmod 1777 /var/spool/mail -- updated : Oct 18,2005
Speed up Squirrelmail access to mail and for some distro like Mandrake 10.x, it can prevent crash. (only for those who use mbox-style mail format)

Clever huh? If you know the theory of the details on how networked boxen connect and talk with each other, you also should know how to make it faster.