在PubSub后端函数或Http函数之间进行选择 [英] Choosing between PubSub Backend Function or Http Function

查看:48
本文介绍了在PubSub后端函数或Http函数之间进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在设计Google PubSub的监听方面,并将为此使用Google Functions.有两种选择,推入和后端功能.使用Http推送,并将消息推送到该函数.后端函数使用触发来调用该函数.

We are designing out our listening side of Google PubSub and will be using Google Functions for this. There are two choices, push and a backend function. Push using Http and will push messages to the function. backend function uses triggering to invoke the function.

我们遇到麻烦的地方是确定哪种方法可能更适合我们的应用程序.我们无法在Google文档中找到这两种方法之间的差异列表.

Where we are having trouble is deciding which approach may be better for our application. We have not been able to find a list of differences between these two methods within the Google documentation.

我们注意到的一些事情是:

Some things we have noticed are that:

  • Http函数使用Expressjs结构,其中后端函数只是一个函数.
  • 似乎退休消息仅适用于后端功能.
  • 尚不清楚死信队列是否以及如何与后端功能一起工作.
  • 每秒可处理的消息数量之间是否有差异?
  • 我们不想问的太多东西了...

这里的问题是,应该确定什么条件来帮助选择用于接收PubSub消息的http函数还是后端函数?

The question here is, what should be determined to help choose between an http function or a backend function for receiving PubSub messages?

推荐答案

我的观点更多地是在安全性和可用性方面.

My point of view is more in term of security and usability.

后端功能

  • 在pubsub和函数之间建立身份验证
  • 不公开曝光
  • 没有死信话题的能力
  • 没有邮件过滤功能
  • 没有订购密钥的容量

推送功能

  • 需要管理自己的安全性(使用 no-allow-unauthenticated 部署该功能,并在您的推送订阅中放入一个服务帐户,以确保安全性
  • 公开曝光(将控件设置为内​​部可阻止所有外部呼叫,包括pubsub推送订阅,您不能使用此功能)
  • 通过PubSub和其他流程触发(非常适合测试或重播事件)
  • 死信主题,重试策略,订购密钥和过滤功能.
  • 更便携的格式.您可以推送到任何端点:Cloud Functions,Cloud Run,Compute Engine甚至是外部端点.您不太会被锁住
  • Require to manage yourself the security (deploy the function with no-allow-unauthenticated and put a service account in your push subscription to ensure the security)
  • Public exposure (ingress control set to internal prevent all external call, pubsub push subscription included, you can't use this feature)
  • Trigger by PubSub and by other processes (great for testing or for replaying events)
  • Dead letter topic, retry policies, ordering key and filtering available.
  • More portable format. You can push to any endpoints: Cloud Functions, Cloud Run, Compute Engine, or even external endpoint. You are less locked-in

在两种情况下都可以重试

因此,我更喜欢推送订阅+ http Cloud Function模型.每秒的消息数量应该是一个问题(至少每秒最多25万条消息)

So, I prefer the push subscription + http Cloud Function model. The number of messages per second should be a concern (up to 250k messages per second at least)

这篇关于在PubSub后端函数或Http函数之间进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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