views:

51

answers:

2

Google documentation on Bucket_size parameter gives just a brief definition, a Wikipedia link and an example:

bucket_size

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.

Could you please provide an explanation of Bucket_size parameter and in which way this parameter could be useful?

+2  A: 

The explanation you posted is fairly comprehensive.

The task queue will only execute tasks when there are enough tokens in the bucket, and will refill the bucket at your specified rate.

You might want to use a lower bucket_size to avoid, for example, hitting the per-minute email quotas, or to avoid having too many tasks running at the same time that need to use the same entity groups to cut down on contention.

Without knowing what you want to do with your own tasks, it's difficult to make suggestions on how you might want to set this parameter; for most uses the default might be perfectly fine.

Wooble
@Wooble to avoid hitting the per-minute email quotas isn't enough to set the rate parameter?
systempuntoout
+1  A: 

The simplest way to describe is that it defines how high a peak in demand you allow a queue to serve.

For example if you define a queue for 5/s requests, with a bucket of 10. This means that it will mostly perform at the rate of five requests per second, but when it's got to it will peak to ten per second.

Swizec Teller
@Swizec yep, that's what i understood reading the doc and rate parameter documentation confirms this with "Depending on the bucket size, brief spikes to a higher rate may be possible."
systempuntoout