Search code examples
emailamazon-web-servicesrds

SMS and Email Queues from Database


I just wanted to discuss a situation I am facing.

I want to send eMails to the users - a lot of eMails - but if I send them at application run time the AWS SDK is slow for emails - bad user experience - atleast for my application.

So what I plan to do is enter the data (email address, content to send, 0) in the database and launch a cron job to read the table and start sending the emails - once it sends the email - it marks the database row as 1.

I read somewhere that is a wrong practice and puts overload on the database server.

Yes, I would use intelligent crons so that no 2 crons overlap or setup a cron each for even and odd numbers etc. I am also looking at 3rd Party alternatives likes http://www.iron.io/ for crons.

Could someone share their experience with a similar situation etc. I just want to use the intelligent solution and not just put a ton of resources on the database and spend hefty on transactions...


Solution

  • Thanks for the detailed response Mike. I finally ended up in implementing a REST API for my application with secure Username+Password+Key access and run it from a 3rd Party Service Iron.io which gets

    www.example.com/rest/messages/format/json
    

    It iterates and sends the messages collecting status in an array - which it then posts back to

    www.example.com/rest/messagesposted
    

    I followed this approach because I had to schedule messages for over 90 days interval and queues hold messages only for say like 14 days.

    What do you recon?