24

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?

Gopi
  • 10,073
  • 4
  • 31
  • 45

1 Answers1

36

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.

Community
  • 1
  • 1
halfdan
  • 33,545
  • 8
  • 78
  • 87
  • +1 Amazing! Also, weird to know that 'java' task queue documentation does not have this info while 'python' documentation has it! I had an impression that java and python documentation would be content-wise similar. As I didnt find the thing under java I made an assumption that it would not be in python as well ! Thanks for pointing it out. – Gopi Sep 18 '10 at 08:34
  • Aah.. found it in java as well. But its not as comprehensive as python's. http://code.google.com/intl/en/appengine/docs/java/config/queue.html – Gopi Sep 18 '10 at 08:37
  • Here's an up-to-date link: https://developers.google.com/appengine/docs/java/config/queue#Queue_Definitions – Lior May 15 '14 at 23:44
  • max processing rate is 500, but max bucket size is only 100. How does it work in this case? little bit weird if the burst is less than the processing rate, do I misunderstand something? – marcadian Jun 26 '15 at 18:27
  • Updated link for official similar info to what @halfdan posted: https://cloud.google.com/appengine/docs/python/config/queue?hl=en – hamx0r Dec 02 '15 at 16:57
  • Hi @halfdan In your last example, "another 5 every next minute", this will happen even the each request takes more than 10 minutes (example)? Because, in this case, the bucket won't is empty, the request still processing. Or, the bucket is only make sense to queue is inactive and received too many request suddenly? Thanks – javaTry Dec 02 '17 at 17:55