[clue-tech] Improving performance of php sending mail via exim on CentOS5

Greg Knaddison greg.knaddison at gmail.com
Wed Mar 3 16:56:36 MST 2010


Hello Cluebies,

I've got a problem that spans PHP, Exim, and maybe Linux just enough
that this is the best place for figuring it out. It's a discussion
site sending e-mail notifications to users. It needs to generate
custom messages for each user so it is calling php's mail() function
once per recipient. There are 7,000 people who get notified with each
new post to the site.

Some investigation that I've done:
* When content is posted some code puts a list of mails to send into a
database table which is then used as a queue. There is another that
pulls e-mails out of the queue and actually sends them. The second one
is running non-stop and currently processes mail at a rate of about
500 mails per minute.
* This is a VPS and according to "cat /proc/cpuinfo | grep processor |
wc -l" it thinks it has 8 cores.
* When I run top the % of cpu for user processes rarely gets over 50%.
mysqld occasionally consumes 100% or even 150% of the CPU, but my
understanding of how top is reporting leads me to believe it is not
CPU bound. The %wa value is almost always 0, or occasionally a
fraction of a percent so I think it's not disk IO bound.
* I tried running "sar -n DEV -f /var/log/sa/sa24 | more" to get a
sense of network traffic, but if I compare an hour when the mail
processing script is running vs. not I don't see a big difference in
any of the values.

We are using exim as the MTA and the php.ini is set so php calls it
directly with /usr/bin/sendmail -t -i (the options don't seem really
relevant, but just in case...)

The exim.conf already has "split_spool_directory = yes" which seems to
be a popular thing to do.

deliver_queue_load_max is set to 3, though I think that only affects
incoming mail which is being processed fine.

So...what can I research or what should I do to improve performance of
this process.

Thanks!
Greg


-- 
Greg Knaddison | 303-800-5623 | http://growingventuresolutions.com
Mastering Drupal - http://www.masteringdrupal.com


More information about the clue-tech mailing list