pubsub动态速率限制 [英] pubsub Dynamic rate limiting

查看:80
本文介绍了pubsub动态速率限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能提供由发布/订阅系统实现的动态速率限制的详细信息?我在gcloud文档或常见问题页面上找不到任何详细信息.

Can anyone give details on the Dynamic rate limiting implemented by the Pub/Sub system? I couldn't find any details on the gcloud docs or the faq pages.

这是我的pubsub用法:我打算在我们的产品中使用pubsub.现在,我有1个主题,1个订阅和1个订阅者(Webhook HTTPS回调).有时我的订阅者会抛出异常(非常少),在这种情况下,我的订阅者应将400响应返回给pubsub,以便pubsub可以保留消息并重试.

Here is my pubsub usage: I'm planning to use pubsub in our production. Right now, I have 1 topic, 1 subscription and 1 subscriber (Webhook HTTPS callback). Sometimes my subscriber can throw an exception (very rarely), in that situation my subscriber shall return a 400 response back to the pubsub, so that the pubsub can retain the message and retry.

如果pubsub收到订阅者的400响应,是否会严重影响其他消息的流量?鉴于缺乏有关如何实现流控制的文档,我主要关注的是一条错误消息对所有其他良好消息的等待时间的影响.

If the pubsub gets a 400 response from the subscriber, will it severely impact the flow rate of other messages? Given the scarce documentation on how the flow control is implemented, i'm mainly concerned about the impact of one bad message on latencies of all other good messages.

如果可以帮助减少不良消息的影响,我可以将一个主题分为多个主题和多个订阅.

I can split my one topic into multiple topics and multiple subscriptions, if it helps reduce the impact of a bad message.

推荐答案

如果仅偶尔返回400,则不会对传递给订户的邮件速率产生严重影响.如《用户指南》 所述,当响应为400时,允许的未处理邮件数将被切成两半.如果您随后为另一条未完成的消息返回成功,则该窗口将立即再次加倍,实际上不会减少所允许的未完成的消息数.

If you are only occasionally returning a 400, you should not see a severe impact on the rate of messages delivered to your subscriber. When a 400 response occurs, as mentioned in the Subscriber Guide, the number of allowed outstanding messages would be cut in half. If you then return success for another outstanding message, the window will be immediately doubled again, effectively not reducing the number of outstanding messages allowed.

用于后续消息的消息传递延迟了一个数量,该数量在后续失败时呈指数增加,其延迟为O(10毫秒).只要返回成功响应,后续消息就不再延迟.因此,来自订阅者的一个400响应(否则返回成功)实际上不会产生任何明显的影响.

Message delivery for subsequent messages is delayed by an amount that is exponentially increasing on subsequent failures, starting with a delay that is O(10s of ms). Whenever a success response is returned, subsequent messages are no longer delayed. Therefore, a single 400 response from a subscriber that is otherwise returning successes shouldn't really have any noticeable impact.

这篇关于pubsub动态速率限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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