Home > Backend Development > PHP Tutorial > There are 1 million users in the database. What is the best way to send bulk text messages?

There are 1 million users in the database. What is the best way to send bulk text messages?

WBOY
Release: 2016-08-04 09:19:01
Original
1985 people have browsed it

With a database of 1 million users, what is the best way to send mass text messages?

Reply content:

With a database of 1 million users, what is the best way to send mass text messages?

The simplest, batch+message queue

Those SMS clouds should support, such as Alibaba. But you definitely can’t issue 1 million at once. Let’s do it in batches. It’s best to write a dedicated service to do this

1 million is actually not much. Today’s SMS platforms basically support sending 1,000 records at a time. If you send it asynchronously, it only takes a few minutes. I have done something similar before, generating a temporary record for the record you sent. Hash, if the transmission fails, it will be sent again and cannot be sent to the user again.

1 For batch extraction, you can consider fetching every 100 or 1000 IDs at a time, which is faster.
2 Concurrent sending will be involved here. For multi-threaded concurrency, you can read SWOOLE WORKMAN
2.1 The content can be repeated. The SMS service provider provides a batch of 100 messages to be sent concurrently. I guess
2.2 If the content is not repeated, then send it one by one
3 Record the sending results and resend regularly

Look at the maximum amount that the SMS interface can accept per second
and then execute it concurrently:

<code>p1&
p2&
p3&
wait
p4&
p5&
p6&
...
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template