On Tue, 28 Sep 2004 14:54:24 +0800, Roger Thomas <[EMAIL PROTECTED]> wrote:
> Quoting Manuel Lemos <[EMAIL PROTECTED]>:
> > For this reason, during deliveries of messages to many recipients, it is better to 
> > pause once in a while to let the queue be fully processed and do not stall other 
> > programs.
> 
> Do you mean, say we fetched 100,000 addresses from database, we make our script 
> sleep for a while after sending, say 1000 mails ?

An alternative solution is to insert a small delay using usleep()
after each message is sent such that the queue never gets overfull to
begin with. Also, keep in mind you are dealing with multiple possible
constraints -- local resource limitations (CPU & disk), and bandwidth
available for connecting to remote hosts.

For reference, I do this kind of thing on a fairly busy server, using
Postfix, for nonprofit clients that do member newsletter mailings in
the 5,000 to 10,000 piece range. I find that I am able to keep system
load tolerably low by limiting my script to about 3-4 messages per
second. In my case I am mostly concerned about managing local CPU. The
queue never backs up.

You will also want to look at protecting your script from dying
prematurely by using ignore_user_abort() and set_time_limit() or
equivalents.

If you are sending only a few hundred messages, that shouldn't place
much of a burden on your server, and you may not need to insert any
delay at all.

(Whereas if you are sending 100,000 messages, I'd have to guess you're
a spammer, as any org with a legitimate reason to mail 100K people at
once would be unlikely to be creating this script from scratch and
asking basic questions in php-general. But I could be wrong.)

good luck,

pb

-- 
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72°39'71"W 42°19'42"N

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to