Google App Engine: bucket_size parameter in task queues

The Google documentation on the Bucket_size parameter gives only a brief definition of the Wikipedia link and example:

bucket_size

Limits the completeness of queue processing,
those. A larger bucket size allows for greater bursts in line speed. For example, consider a queue with a rate of 5 / s and a bucket size of 10. If this queue is inactive for some time (letting its β€œtoken bucket” fill up) and 20 tasks are suddenly in the queue, 10 tasks will be immediately allowed to be completed. But in the next second, a total of 5 more tasks will be completed because the marker bucket was depleted and refueled at a given speed of 5 / s.

Could you explain the explanation of the Bucket_size parameter and how this parameter can be useful?

+7
google-app-engine task-queue
source share
2 answers

The easiest way to describe is that it determines how high is the peak of demand that you allow to serve the queue.

For example, if you define a queue for 5 / s requests with a bucket of 10. This means that it will basically run at a speed of five requests per second, but when it reaches it, it will peak to ten per second.

+3
source share

The explanation you posted is quite complete.

The task queue will perform only those tasks when there are enough tokens in the bucket, and will replenish the bucket at the specified speed.

You might want to use a lower bucket_size to avoid, for example, getting minute quotas on email, or to avoid too many tasks being performed at the same time when you need to use the same entity groups to reduce competition,

Not knowing what you want to do with your own tasks, it's hard to make suggestions on how you can set this parameter; for most applications, the default value may be fine.

+4
source share

All Articles