配置应用程序引擎推送任务队列以进行twilio SMS验证 [英] Configure app engine push task queue for twilio SMS verification

查看:151
本文介绍了配置应用程序引擎推送任务队列以进行twilio SMS验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是关于如何在Java App Engine中实现一个原子整数?。基本上我创建了一个推送任务队列来实现短信验证。我正在使用Twilio发送短信。每个SMS都是一个五位数的PIN码。以下是针对应用引擎的 queue.xml 文件。

  <队列条目> 
<队列>
<名称> sms-verification< / name>
< rate> 200 / s< / rate>
<桶大小> 100< /桶大小>
< max-concurrent-requests> 10< / max-concurrent-requests>
< / queue>
< / queue-entries>

我想在不创建新实例的情况下获得最佳速率。我认为实例创建在应用程序引擎上很昂贵,但我不确定任务队列是否相同。那么这个配置文件好吗?它错过了什么吗?这是我第一次创建一个,所以感谢您的任何指导。

解决方案

这个问题没有正确或错误的答案。您将必须使用配置设置来获得满足您需求的最佳结果。您需要考虑以下几点:


  1. 您在整个一天/周内加载:或多或少甚至有尖锐的峰值。 li>
  2. 延迟容忍:等待邮件发送的时间可以接受多长时间。

显然,如果您想要立即发送所有消息,则费用会更高,如果您可以容忍一小段延迟(例如1分钟),则费用会更低,因为这样可以消除至少一些突然的高峰。

请注意,音量越高,这些优化就越不重要,因为超过20个实例的1个新实例不像1个实例中的1个新实例那样昂贵。


This question is a follow up to How to implement an atomic integer in Java App Engine?. Basically I am create a push Task Queue to implement SMS verification. I am using Twilio to send the SMS. Each SMS is a five digit pin number. The following is my queue.xml file for app-engine.

<queue-entries>
  <queue>
    <name>sms-verification</name>
    <rate>200/s</rate>
    <bucket-size>100</bucket-size>
    <max-concurrent-requests>10</max-concurrent-requests>
  </queue>
</queue-entries>

I want the best rate I can get without creating a new instance. I believe instance creation is expensive on app-engine, though I am not sure if it's the same for task queues. So is this configuration file good? Is it missing anything? This is my first time creating one so thanks for any guidance.

解决方案

There is no right or wrong answer to this question. You will have to play with the configuration settings to get the optimal results for your requirements. You need to take the following into account:

  1. You load throughout the day/week: more or less even or with sharp peaks.
  2. Delay tolerance: how long it is acceptable to wait until the message is sent.

Obviously, it will be more expensive if you want to send all messages immediately, and less expensive if you can tolerate even a small delay (e.g. 1 minutes) as it would smooth out at least some sudden peaks.

Note that the higher the volume, the less important these optimizations become, as 1 new instance over 20 live is not as expensive as 1 new instance over 1.

这篇关于配置应用程序引擎推送任务队列以进行twilio SMS验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆