在Google App Engine上推送与拉队列

时间:2020-11-27 02:16:56

So far, no one (not even the GAE docs) has been able to give me a really clear description of what the difference is between a push queue and a pull queue.

到目前为止,还没有人(甚至GAE文档)能够非常清楚地描述推送队列和拉取队列之间的区别。

My understanding is that the Task Queue API allows you to define task queues where work can be enqueued to. Somehow, this works with GAE's auto-scaling feature so that you don't need to explicitly manage the number of worker threads consuming tasks off these queues: GAE just does it for you.

我的理解是Task Queue API允许您定义可以将工作排入的任务队列。不知何故,这与GAE的自动缩放功能一起使用,因此您无需显式管理消耗这些队列任务的工作线程数:GAE就是为您完成的。

But nowhere can I find a "King's English" description of the difference between push and pull queues. What is a "push queue" pushing? What is a "pull queue" pulling? Are they both configured inside queues.xml?

但是我无处可寻找推送和拉取队列之间差异的“King's English”描述。什么是“推队”推?什么是“拉队列”拉?它们都是在queues.xml中配置的吗?

1 个解决方案

#1


24  

In a pull queue you enqueue tasks into the queue and your code needs to pull them, you pull them by leasing tasks from the queue and deleting the tasks. if you don't delete the tasks and the lease time is expired the system will return the tasks back to the queue.

在拉取队列中,您将任务排入队列,并且您的代码需要拉取它们,您可以通过从队列租用任务并删除任务来拉取它们。如果您不删除任务并且租约时间已过期,则系统会将任务返回到队列。

You can use pull queue (for example) to aggregate a multiple work units that can be processed together. Another example: queuing task that will be pull by an external machine (like EC2 or gCompute) in order to process the task in a manner that AppEngine can't.

您可以使用拉取队列(例如)来聚合可以一起处理的多个工作单元。另一个例子:排队任务将由外部机器(如EC2或gCompute)拉动,以便以AppEngine不能的方式处理任务。

In push queue you enqueue tasks into the queue but AppEngine will dequeue them and will run them on the handler specified by the task. You can control the task processing rate, how to control task execution failures and AppEngine will decide how many instances (threads) to use todo the processing.

在推送队列中,您将任务排入队列,但AppEngine将使它们出列,并将在任务指定的处理程序上运行它们。您可以控制任务处理速率,如何控制任务执行失败,AppEngine将决定使用多少实例(线程)进行处理。

#1


24  

In a pull queue you enqueue tasks into the queue and your code needs to pull them, you pull them by leasing tasks from the queue and deleting the tasks. if you don't delete the tasks and the lease time is expired the system will return the tasks back to the queue.

在拉取队列中,您将任务排入队列,并且您的代码需要拉取它们,您可以通过从队列租用任务并删除任务来拉取它们。如果您不删除任务并且租约时间已过期,则系统会将任务返回到队列。

You can use pull queue (for example) to aggregate a multiple work units that can be processed together. Another example: queuing task that will be pull by an external machine (like EC2 or gCompute) in order to process the task in a manner that AppEngine can't.

您可以使用拉取队列(例如)来聚合可以一起处理的多个工作单元。另一个例子:排队任务将由外部机器(如EC2或gCompute)拉动,以便以AppEngine不能的方式处理任务。

In push queue you enqueue tasks into the queue but AppEngine will dequeue them and will run them on the handler specified by the task. You can control the task processing rate, how to control task execution failures and AppEngine will decide how many instances (threads) to use todo the processing.

在推送队列中,您将任务排入队列,但AppEngine将使它们出列,并将在任务指定的处理程序上运行它们。您可以控制任务处理速率,如何控制任务执行失败,AppEngine将决定使用多少实例(线程)进行处理。