谷歌应用程序引擎中队列的“桶大小”是什么意思? [英] What is meant by 'bucket-size' of queue in the google app engine?

查看:166
本文介绍了谷歌应用程序引擎中队列的“桶大小”是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google应用引擎任务队列的配置为(示例)

 < queue> 
<名称>邮件队列< /名称>
< rate> 5 / m< / rate>
<桶大小> 10< /桶大小>
< / queue>

在这里,桶大小是什么意思?我无法在谷歌应用程序引擎文档中找到关于此的全面文档。



是否将此指定为10意味着如果100个任务在一瞬间排队,那么只有10个将会排队放在队列中,休息会被忽略?

解决方案

bucket-size完美描述这里



< blockquote>

限制队列处理的突发性,即更高的桶大小允许队列执行速率更高的峰值。例如,考虑一个速度为5 / s,桶大小为10的队列。如果该队列在一段时间内处于非活动状态(允许其令牌桶填满),并且20个任务突然排队,它将被允许立即执行10个任务。但在接下来的第二步中,只有5个任务可以执行,因为令牌桶已经用尽,并以5 / s的指定速率重新填充。

如果没有为队列指定bucket_size,则默认值为5.


对于您的情况,这意味着如果有100封邮件排队,只有10个正在执行,另外每5分钟就有5个。您不会丢失任何消息,但是如果您的存储桶大小和费率太低,他们将排队。


Google app engine task queues have configuration as (example)

  <queue>
    <name>mail-queue</name>
    <rate>5/m</rate>
    <bucket-size>10</bucket-size>
  </queue>

Here, what does the 'bucket-size' mean? I could not find a comprehensive documentation about this in google app engine documentation.

Does specifying this as 10 means that if 100 tasks are queued at an instant only 10 of those will be put in the queue and rest will be ignored?

解决方案

bucket-size is perfectly described here:

Limits the burstiness of the queue's processing, i.e. a higher bucket size allows bigger spikes in the queue's execution rate. For example, consider a queue with a rate of 5/s and a bucket size of 10. If that queue has been inactive for some time (allowing its "token bucket" to fill up), and 20 tasks are suddenly enqueued, it will be allowed to execute 10 tasks immediately. But in the following second, only 5 more tasks will be able to be executed because the token bucket has been depleted and is refilling at the specified rate of 5/s.

If no bucket_size is specified for a queue, the default value is 5.

For your case it means that if 100 messages are queued, only ten are directly being executed and another 5 every next minute. You won't loose any messages, but they will queue up if your bucket-size and rate is too low.

这篇关于谷歌应用程序引擎中队列的“桶大小”是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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