Blog Links

Quick dirty fix to speed up qmail for bulk mailings

We were getting around 2 mails per second with qmail for a bulk emailing, which was not fast enough and rather than try and patch qmail to fix a bunch of problems,  we chose to put the qmail queue on a temporary file system.

It appears that one of qmails bottlenecks is disk access (so perhaps noatime and other fixes for ext3 filesystem might also help), We used a 500meg temp disk, which seemed plenty big enough, actually you could probably get away with 50meg, Once set up use linux “df” command to monitor the usage.

After moving to the temp disk we were getting aroung 6 messages per second.

Here is the procedure we used to create a temporary file system and mount it in the correct place.

First stop qmail

service qmail stop
or
/etc/init.d/qmail stop

rename the queue

mv /var/qmail/queue /var/qmail/queue_original

make a new mount point

mkdir /var/qmail/queue

make the temp filesystem and mount it (here we make a 500mb disk)

mount -t tmpfs -o size=500M,mode=0744 tmpfs /var/qmail/queue/

Copy the old queue data (with owner & permissions in-tact)  to the new temp filesystem

cp -pR /var/qmail/queue_original/ /var/qmail/queue/

Make the file permissions on /var/qmail/queue the same as/var/qmail/queue_original using chmod & chown

in my case

chown qmailq:qmail /var/qmail/queue
chmod 750 /var/qmail/queue

Now restart qmail

service qmail start
or
/etc/init.d/qmail stop

That should do it, if your server crashes you’ll probably mess up qmails queue, but you can always remove the temp disk and rename  your queue_original back to queue. Obviously after a reboot qmail will have no queue so you will need to either set it back to how it was before the temporary file system, or re-initialize the temporary file system with a copy of the original queue

Chris

If this has been useful to you, and you would like to buy me a coffee, or help towards my monthly server costs please click here to make a donation via paypal.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>