I'm trying to do a little pre-planning here...
Let's say I have a user table that has 25 million users spread across all 50 states.
Lets also say I have to send an EMERGENCY email to each of these 25 million users... (asteroid hitting planet type of emergency)
What would be the best way to do this to ensure that A) everyone gets their message; B) no one gets duplicate messages; C) The messages go out as fast as possible.
Right now I have this set up to
- Query all users who have not received this message
- Mark the message and "in progress"
- Go into a while loop and send each user their email
A) Log each email when sent to the user (will avoid dups) - Mark the message as "complete" once the last message is sent
Obviously, it would be far faster if multiple computers were handling this send process so how would one (meaning me) go about structuring this so that multiple computers can pull from the user table, send and mark as sent without duplicating efforts?
I think a file/record lock but not sure if we can do that in mySql...
Any other strategies?