Per Jessen wrote:
Richard Heyes wrote:

Bearing in mind I haven't yet done any benchmarks, which do you think
is faster - SMTP with multiple RCPT commands or the PHP mail()
function (with it launching a separate sendmail process for each
mail() function call)?


I've done some rough benchmarking -
1. Using mail(), same email sent to 1000 users.

Script finished in 200ms (1000 emails delivered to local MTA). Delivery to target MTA over 100Mbit LAN took about 6s.

2. Using mail(), same email sent to 10000 users (in blocks of 1000
recipients).

Script finished in 2.6s (10000 emails delivered to local MTA). Delivery to target MTA over 100Mbit LAN took about 4m20s.

3. Using mail(), but individual emails sent to 1000 users.

Script finished in 59s (1000 emails delivered to local MTA). Delivery to target MTA over 100Mbit LAN took about 60s.

4. I didn't bother with 10000 individual emails.

5. Repeat case 3, but actual calls of mail() forked using pcntl_fork.
50ms.  I didn't bother timing the delivery to target MTA, but I estimate
the same as in case 3.

6. Same email to 1000 users sent by piping to "sendmail -oi -t"

60ms. I didn't bother timing the delivery to target MTA.

7. Same email to 10000 users sent by piping to "sendmail -oi -t"

230ms.  I didn't bother timing the delivery to target MTA.

8. Same email to 100000 users sent by piping to "sendmail -oi -t"

2.4s. I didn't bother timing the delivery to target MTA.

Hardware was a plain P4, 2.4GHz running openSUSE.


You might be able to beat cases 6-7-8 by doing direct SMTP, but I doubt
if it'll be worth your effort.


/Per Jessen, Zürich

Per's results were pretty much as i'd expected :)

Reply via email to