P
P
p4s8x2011-06-16 20:58:57
PHP
p4s8x, 2011-06-16 20:58:57

Exim queuing speed via php mail(...)

I use my own script for mass mailings in php. Previously, there were few mailings, but now there is a need to accelerate significantly increase the volumes.
I did a lot of measurements - the execution speed of the mail(...) function varies from 0.07 to 2.9 with an average = 0.87, i.e. a little more letters per second, but it is necessary to bring it up to something like 20 letters / sec.

Email size average = 62020 characters, but 1 character emails are sent at the same speed.

Server - VDS
2400 Mhz
2048 RAM (1900 free)

amd64
FreeBSD 8.2

Exim version 4.73
PHP 5.2.17 with Suhosin-Patch 0.9.7 (cli)

When executing the
load averages script: 0.98, 0.80, 0.72
CPU 97% IDLE.
HDD 20GB(12GB free) Tell me

, how can I increase the speed of queuing? Where should you look for a bottleneck?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
impass, 2011-06-16
@impass

As far as I know, the mail() function uses a call to the local MTA (usually /usr/sbin/sendmail on Unix). Those. how many calls to mail () - so many times the external interface is launched to send. Of course, this method is far from being at least somewhat fast.
In order not to reinvent the wheel, it is worth reading at least the following forum topic
PHP Bulk Email - Best Practices?

A
Alexey, 2011-06-16
@alexxxst

Enable write cache for disk.
For me, this increased the speed to an average of 30 per second.

P
Puma Thailand, 2011-06-17
@opium

Send directly to Exim, not via mail.
What's in an exim config?
For example, are there such things?
The other day I made a mailing to 8000 addresses. Everything went off without a hitch. Maybe someone will need to have used here are the options in the config file (you can add routers to the mailman):
Code: Select All • Deploy
smtp_accept_max = 150
smtp_accept_max_per_connection = 100
smtp_connect_backlog = 30
smtp_accept_max_per_host = 50
smtp_accept_reserve = 30
smtp_reserve_hosts = + relay_from_hosts
split_spool_directory is = to true
remote_max_parallel = 50

M
MealstroM, 2011-06-17
@MealstroM

Use php mailer smtp level

S
Sergey Beresnev, 2011-06-23
@sectus

Indeed, why not use a php mailer that keeps SMTP open throughout all sending and sends through it.
If you still make it so that the queue can be parsed simultaneously by different scripts (processes) without collisions, then you can still send it in parallel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question