If you're talking over a million messages, I think you need a solution that
is designed specifically for handling mail. I would suggest looking into
qmail (www.qmail.org) to replace sendmail on the server in question.  qmail
is much more efficient than sendmail in handling large amounts of mail, and
it won't drag your server down.

I think it's possible that some of your smtp connections are hanging for
some reason or another, and PHP is not timing them out.  10,000 connections
out of 1 million emails means about 1% of your connections are failing in
some way -- not surprising when talking smtp.

If you're talking smtp directly to remote mail server, how are you handling
retries, failed mail, etc.?  Again, I would suggest qmail since it would
take care of all of that for you, instead of you having to reinvent the
wheel.  I have a script which sends out about 30,000 emails once a month,
through qmail, and it is set up so that qmail automatically routes any
bounces back to another script where I can update my database to reflect
which users' mail is bouncing.

Doug Granzow

"J.R. Lillard" <[EMAIL PROTECTED]> wrote in message
> i've got a command-line php script that i've been using to deliver large
> amounts of e-mail.  originally it relied on mail() to deliver the
> messages but i could easily overload sendmail and bring the box (redhat
> 7.1) to a crawl.  so i am now using the various network functions to
> speak smtp directly from the script.  i seem to be having a problem with
> an excessive number of tcp connections that eventually brings down the
> machine.
> i have attempted a semi-multi-threaded approach by spawning off
> additional copies of the script to deliver more mail simultaneously.  so
> i might have 100 copies of the script running at the same time.  and
> this was after dumping a million messages into my mysql-based mail
> queue.  things may run okay for a few hours...maybe even a day...but
> then doing a netstat shows over 10k tcp connections.  and the only way
> i've found to fix the problem is to reboot the machine.
> thinking that i was attempting too many connections at the same time, i
> throttled down the number of threads to 25.  this slowed down my mail
> delivery of course.  and it allowed the machine to stay up longer.  but
> i eventually ran into the same problem after maybe two or three weeks.
> just before it died, i was showing over 30k tcp connections.
> are they any known issues in the php networking code that would cause
> this to happen?  as far as i know, i should never have more than 25 tcp
> connections open.  but i'm not sure if they are not being closed
> properly or what.
> --
> -jr

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to