PHP sendmail 90 second delay on Dotcloud [solved]

For months we have been having upstream timeout issues with our Dotcloud PHP service running nginx and php-fpm.  Amongst other causes, we found that after our instances were up for more than a day, php’s mail function using sendmail was consistantly taking exactly 90 seconds to send an email.  Unacceptable.

After going back and forth with Dotcloud’s support, we determined that sendmail was spawning 3 processes to send emails, and apparently on their boxes, it takes 30 seconds to spawn a new process.  Seems like it shouldn’t take that long, but it does.  The solution to this issue was to simply not use sendmail.  Instead, we are using SMTP protocol to talk to postfix locally on a php instance.  Originally I wanted to avoid sending emails via SMTP because it can be slow when authenticating to a remote server.  Because we are using SMTP locally with no authentication it is very fast.

In short, DO NOT USE sendmail on DotCloud PHP instances or it will cause all kinds of problems.

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>