Skip to main content
Inspiring
February 16, 2011
Question

Best method for >1000 CFHTTP calls?

  • February 16, 2011
  • 1 reply
  • 783 views

Hi there,

We're testing Amazon's new Simple Email Service with a CF web app. We will sometimes need to send out 5000-10000 individual emails.

CFMAIL works will enough for us when we have SMTP service since it spools to the disk and the user doesn't have to wait for all the mail to be delivered - but sine Amazon's SES doesn't allow SMTP and has to be accessed via web service, that means a CFHTTP call for every email.

What is the best way to approach a problem like this? Just create a thread with cfthread and no request timeout so it acts without respect to what the user is doing and without making the user wait? A single cfthread looks like it can send about 2 cfhttp calls/emails a second from our server (and that may be throttled on Amazon's end rather than ours - still looking into that) and that's enough speed for us, though our thread timed out after about 60 seconds (the global request timeout) - I'm assuming we can override this with a <cfsetting> either on the page with the cfthread or inside the cfthread.

Thank you!

    This topic has been closed for replies.

    1 reply

    orangexception
    Participating Frequently
    February 17, 2011

    Might be best to find a SMTP provider like mailchimp?

    If you're stuck using the Amazon's webservice, then you're looking at:

    1 thread that loops through emails and calls the webservice.

    5000-10000 threads, 1 thread per email, that individually calls the webservice.

    You'd probably want to record the state of the emails too (sent successfully, locked by thread, pending) so you can resend on failures.

    AquitaineAuthor
    Inspiring
    February 17, 2011

    Yeah, we're looking at SMTP alternatives. We just like how Amazon's solution scales on their end (even if it doesn't on ours) and figure they'll offer SMTP auth one day.

    Right now we've just got one thread that loops through and makes CFHTTP calls as fast as it can. It did a thousand emails in about three minutes, which is fine speed-wise. I'm not wild about CFHTTP as the basis for our email infrastructure, but the client likes Amazon's pricing a lot more than most of the services like MailChimp.