NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP and memory usage

csnyder chsnyder at gmail.com
Fri Oct 15 14:36:24 EDT 2004


You could process 100-500 users at a time, using a LIMIT condition on
your SELECT.

There's a bunch of different ways to implement this, but I would
probably end up writing a mailer that would:
1) launch every minute from cron
2) check for another running mailer instance
3) if not, check for a pending message
4) look up the id of the last user to be sent the pending message
5) load another 100 users beginning with that id
6) loop and send
7) write the id of the last user somewhere that the next instance of
the mailer can find it, or close out the message if done.

This gives you a lot of control over the amount of mail that's flying
out of your box at any one time, and you can also queue messages to be
sent. If everything breaks, you have some idea of who got the message
and who didn't, so you avoid duplicates.



More information about the talk mailing list