Database has 1 million users how to send a mass message method is the best?
Reply content:
Database has 1 million users how to send a mass message method is the best?
The simplest, batch+ message queue
Those SMS clouds should support, such as Ali greater than. But certainly not 1,000,001 from the hair, in batches, it is best to write a service to do this thing
1 million actually not much, now the SMS platform basically support a one-time send 1000 records, if you send a few minutes asynchronous, I have done something similar before, the record you sent to generate a temporary hash, in case of failure to send, to resend, can not give users relapse.
1 Batch out, this you can consider every 100 or 1000 separate ID once fetch, so fast.
2 Concurrent send here will be involved, involving multithreading concurrency can be seen swoole WORKMAN
2.1 content can be repeated, the SMS service provider to send 100 batches of time to estimate
2.2 If the content is not repeated, then a single piece of hair
3 record sending results, regular re-hair
Look at the message interface can be the maximum acceptable amount per second
Then execute concurrently:
p1&p2&p3&waitp4&p5&p6&...