GAE 中批量电子邮件的限制
我正在开发一个投票应用程序,我需要向每个选民发送一封电子邮件,告知他或她有关选举的信息。我看到了三种执行此操作的方法,我很好奇使用每种方法可以发送的电子邮件数量的大致限制是多少:
在用户请求中,将一个任务添加到任务队列中,其中每个任务发送一封电子邮件。这里的限制是我在 30 秒内可以排队的任务数量。有没有办法可靠地估计这一点?
在用户请求中,将一个任务添加到任务队列,其中该任务将任务添加到第二个任务队列,其中第二个队列中的每个任务发送一封电子邮件。由于此处的限制为 10 分钟,因此我可以发送的电子邮件数量是方法 1 的 20 倍,这是一个合理的估计吗?
使用没有时间限制的后端,这样我就可以发送尽可能多的电子邮件。
如果方法 1 或 2 可以发送足够数量的电子邮件,我宁愿坚持使用它们,以避免使用后端的额外复杂性。如果重要的话,我正在使用 Python API。
I'm working on a voting app where I need to send an email to each voter to inform him or her about the election. I see three methods for doing this and I'm curious what the approximate limits on the number of emails I could send with each method:
In a user request, add a task to a task queue where each task sends one email. The limit here is how many tasks I can queue up in 30 seconds. Is there a way to estimate this reliably?
In a user request, add one task to a task queue where that one task adds tasks to a second task queue where each task in the second queue sends a single email. Since the limit here is 10 minutes, is it a reasonable estimate that I can send 20 times as many emails as with method 1?
Use a backend which doesn't have a time limit so I could presumably send as many emails as I need to.
If methods 1 or 2 could send a sufficient number of emails I would prefer to stick with them to avoid the extra complexity of using a backend. If it matters, I'm using the Python API.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将按顺序发送电子邮件的单个任务排队,在每封电子邮件后检查挂钟时间。当时间接近 10 分钟时,链接另一个任务以从当前任务停止的地方继续。如果您想更快地发送电子邮件,请将其并行化,并将多个任务排队,每个任务将电子邮件发送给用户子集。
Enqueue a single task which sends emails sequentially, checking the wallclock time after each email. When the time approaches 10 minutes, chain another task to continue where the current task left off. If you want to send emails faster, parallelize this, and enqueue several tasks that each send emails to a subset of users.