Server Scaling Issue

So I am having several issues which are getting worse as we expand the number of sites and users on our servers.

We currently have 3 servers with about 3-10 sites per server and about 30-40 e-mail accounts.

All of our servers are Ubuntu 10.4 with Raid 5 or Raid 1 configurations.

With almost all of our accounts the number of e-mails has quickly exceeded past 3000. The e-mails are simply listed in the directory. Then we have several file uploading sites with the same issues which we are working on.

The problem now is all of our servers are taxing our drives and everything is slowing down.

With a linux file system it is recommended not to have more than 1000 files or folder listed per directory. With our sites this is an easy fix and files uploaded are categorized by month. However, with e-mails this is a growing problems and size limits do not easily fix this.

Not sure if this is really your issue. The maildir format handles large amounts of email very well as new email get always put into a separate folder until they get fetched and also all email are indexed and this index is used by the pop3 / imap daemon to get information about the email, so the files dont get listed in the filesystem when someone accesses the mailbox. Additionally, your setup is quite small with just 3000 email per mailbox, so I doubt that this is the issue

1) Which filesystem do you use for the email partition?
2) Which pop3 / imap daemon do you use?
3) How high is the system load (use top or uptime)
4) Do you use a virtualisation software on this server?
5) Is this a software or hardware raid?

The server uses software raid 5. There is no virtualization on the server. However, basic graphic desktop packages are installed and courier is used for mail. The "Ubuntu Perfect Server 9.10" with all values set to what the recommended setup should be.

It seems to be a problem stemming from the setup of our mysql database.

For those interested I feel like this script is a must!

Download MySQLTuner using the following command
wget http://mysqltuner.com/mysqltuner.pl
To run the script, simply make it executable and run it:
chmod +x mysqltuner.pl
sudo ./mysqltuner.pl

It will give you options for tuning your database.
We had queries that were so intensive that they completely took over the mysql server for 30 seconds at a time. I didn't actually realize each time a user logs in through IMAP their authentication needed to be queried through the mysql server.