Applications define task queues in a configuration file called
You can use
queue.yaml to configure
This configuration file is optional for push queues, which have a
The following a basic example that defines a named queue and overrides the default processing rate:
queue: - name: my-push-queue rate: 1/s
The following is a more complex example of a
queue.yaml configuration that
demonstrates setting up task retries and modifying the default processing rate.
queue: - name: fooqueue rate: 1/s retry_parameters: task_retry_limit: 7 task_age_limit: 2d - name: barqueue rate: 1/s retry_parameters: min_backoff_seconds: 10 max_backoff_seconds: 200 max_doublings: 0 - name: bazqueue rate: 1/s retry_parameters: min_backoff_seconds: 10 max_backoff_seconds: 200 max_doublings: 3
queue.yaml file is a YAML file whose root directive is
This directive contains zero or more named queues. Each queue definition can
specify the following elements:
Optional. If you don't specify bucket_size for a queue, the default value is 5. We recommend that you set this to larger value because the default size may be too small for many use cases: the recommended size is the processing rate divided by 5 (rate/5).
Task queues use a "token bucket" algorithm for dequeueing tasks. The bucket size limits how fast the queue is processed when many tasks are in the queue and the rate is high. The maximum value for bucket size is 500. This allows you to have a high rate so processing starts shortly after a task is enqueued, but still limit resource usage when many tasks are enqueued in a short period of time.
For more information on the algorithm, see the Wikipedia article on token buckets.
Optional. Sets the maximum number of tasks that can be executed simultaneously from the specified queue. The value is an integer. By default, the limit is 1000 tasks per queue.
Restricting the number of concurrent tasks gives you more control over the queue's rate of execution and can prevent too many tasks from running at once. It can also prevent datastore contention and make resources available for other queues or online processing.
Required. The name of the queue.
A queue name can contain uppercase and lowercase letters, numbers, and hyphens. The maximum length for a queue name is 100 characters.
All apps have a push queue named default. This queue has a preset rate
of 5 tasks per second, but you can change this rate by defining a
default queue in
How often tasks are processed on this queue. The value is a number
followed by a slash and a unit of time, where the unit is
If the number is
Optional. Configures retry attempts for failed tasks. This addition allows you to specify the maximum number of times to retry failed tasks in a specific queue. You can also set a time limit for retry attempts and control the interval between attempts.
The retry parameters can contain the following subelements:
Optional. A string naming a service/version, a frontend version, or a backend, on which to execute all of the tasks enqueued onto this queue.
The string is prepended to the domain name of your app when
constructing the HTTP request for a task. For example, if your app ID
If target is unspecified, then tasks are invoked on the same version of the application where they were enqueued. So, if you enqueued a task from the default application version without specifying a target on the queue, the task is invoked in the default application version. Note that if the default application version changes between the time that the task is enqueued and the time that it executes, then the task will run in the new default version.
If you are using services along with a dispatch file, your task's HTTP request might be intercepted and re-routed to another service.
The following elements can be specified for all queues within an app: