GAE:队列率和max_concurrent_requests之间的关系 [英] GAE: relationship between queue rate and max_concurrent_requests

查看:138
本文介绍了GAE:队列率和max_concurrent_requests之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读有关 GAE任务队列和我的文档我不清楚 rate max_concurrent_requests 之间的关系(如果有的话)。 rate 是指单个请求,例如rate = 20 / s和max_concurrent_requests = 10有效地表示最多200个请求/秒总数?

解决方案

有3个参数: / b>


  • 存储桶大小〜最大爆率
  • rate 〜正常处理速度

  • 最大并发请求数〜附加并发数限制



当任务开始执行时,它会查看存储桶以检查是否存在令牌或插槽。


  • 如果是这样,令牌的数量会减少一个,如果小于 max,则任务开始执行并发请求已经在执行。

  • 如果没有,任务将不得不等待新的令牌/槽以费率



如果您有一个大桶,当流量很低时可能会填满,例如桶大小为20,需求突然高峰时,您可以开始20个任务,因为他们都可以获得令牌。然后桶是空的,任务将以速度处理。



最大并发请求可以另外限制由于长时间运行的任务会降低整个处理速度,所以突发率很高没有最大并发请求,只有桶大小确定处理速度,而不是任务的持续时间。


I'm reading the docs about GAE task queues and I'm unclear about the relationship (if any) between rate and max_concurrent_requests. Does rate refer to a single request so that e.g. rate=20/s and max_concurrent_requests=10 effectively means max 200 requests/s in total?

解决方案

There are 3 parameters :

  • bucket size ~ the maximum burst rate
  • rate ~ normal processing rate
  • max concurrent requests ~ additional concurrency restriction

When a tasks starts executing, it looks at the bucket to check if there is a token or slot free.

  • If so, the number of tokens is decreased with one and the task starts executing if there are less than max concurrent requests already executing.
  • if not, the task will have to wait for a new token/slot to arrive at the speed of rate.

If you have a big bucket, it may fill up when traffic is low and e.g. with a bucket size of 20 and a sudden peak in demand, you can start 20 tasks because they all can get a token. Then the bucket is empty and the tasks will be processed at rate speed.

Max concurrent requests can additionally limit the burst rate since long running tasks will slow down the whole processing. Without max concurrent requests, only the bucket size and rate determine the processing speed, not the duration of your tasks.

这篇关于GAE:队列率和max_concurrent_requests之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆