gpt4 book ai didi

amazon-web-services - AWS 相当于 Firebase 实时数据库的是什么?

转载 作者:行者123 更新时间:2023-12-03 05:29:37 25 4
gpt4 key购买 nike

我目前正在开发一个新的游戏项目,该项目将由 React Native 前端和基于 Lambda 的后端组成。该应用程序需要一些实时功能,例如事件用户记录、地理围栏等。

我正在研究 Firebase 的实时数据库,它看起来是一个非常优雅的实时数据同步解决方案,但我认为 AWS 没有类似的解决方案。

我能想到的仅使用 AWS 服务实现“无服务器”实时的 3 个选项是:

选项 1:通过 WebSocket 进行 AWS IoT 消息传递

这个非常明显,是通过 IoT SDK 管理的 WebSockets 连接。我正在考虑触发 Lambda 来响应入站和出站事件,并仅使用 WebSocket 作为实时层,像通常那样在应用程序客户端上构建自定义处理逻辑。

至少与 Firebase 相比,这样做的缺点是我必须自己处理事件中的数据,这将在 WebSocket 之上添加另一层管理,并且必须使用 API 数据层进行标准化应用程序的商店。

优点:

  • 可扩展的双向实时连接

缺点:

  • 仅在应用打开时有效
  • 需要实现消息结构
  • 需要管理多个传输层

选项 2:推送触发重新获取

另一种选择是使用推送通知作为实时触发器,但使用对 API Gateway 的常规 HTTP 请求来实际获取更新的负载。

我喜欢这种方法,因为它只坚持一个传输层和应用程序状态的单一事实来源。当应用程序未打开时,它也会触发更新,因为这些是推送通知。

缺点是,这是大量的自定义工作,并且推送通知与需要获取的数据之间的映射可能很困难。

优点:

  • 即使应用关闭,推送通知也能正常工作
  • 单一事实来源,传输层

缺点:

  • 大多数自定义解决方案
  • 总体上将涉及更多 HTTP 请求

选项 3:Cognito 同步这对我来说比较新,我不确定它是否真的可以与服务器交互。

Cognito Sync 提供用户状态同步。跨设备完成离线支持,并且是 Cognito SDK 的一部分,无论如何我都会使用它。这听起来正是我正在寻找的内容,但找不到任何确凿的证据来证明是否可以修改或“触发”来自 AWS 而不仅仅是来自其中一台设备的更新。

优点:

  • 提供抽象的实时数据模型
  • 已连接到 Cognito 用户记录 OOTB

缺点:

  • 不确定是否可以通过 Lambda 进行修改或更新

我想知道是否有人有在 AWS 上进行实时处理(作为基于 Lambda 的架构的一部分)的经验,以及您是否对最佳的继续方式有什么看法?

最佳答案

我向 AWS 支持人员提出了类似的问题,这是他们的答复。

我向他们提出的问题:

What's the group of AWS services (if it's possible) to give that same in-browser real-time DBaaS feel like Firebase?

AWS Cognito seems to be great for user-accounts. Is there anything similar for the WebSockets / real-time DB part?

他们的回应:

To your question, Firebase is closest to the AWS service AWS MobileHub. You can check out more details below about mobilehub from below link.

https://aws.amazon.com/mobile/details/ https://aws.amazon.com/mobile/getting-started/

"AWS Cognito seems to be great for user-accounts. Is there anything similar for the WebSockets / real-time DB part?"

Amazon Dynamodb is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. It is a fully managed cloud database and supports both document and key-value store models. Its flexible data model, reliable performance, and automatic scaling of throughput capacity, makes it a great fit for mobile, web, gaming, ad tech, IoT, and many other applications.

Amazon Dynamodb can be further optimized with Amazon DynamoDB Accelerator (DAX) which is a fully managed, highly available, in-memory cache that can reduce Amazon DynamoDB response times from milliseconds to microseconds, even at millions of requests per second.

For more information, please see below documentation.

https://aws.amazon.com/dynamodb/getting-started/ https://aws.amazon.com/dynamodb/dax/

Should you have any further questions, please do not hesitate to let me know.

Thanks.

Best regards,

Tayo O. Amazon Web Services

Check out the AWS Support Knowledge Center, a knowledge base of articles and videos that answer customer questions about AWS services: https://aws.amazon.com/premiumsupport/knowledge-center/?icmpid=support_email_category

此外,在研究这个答案时,我还发现了这个,看起来很有趣:

https://aws.amazon.com/blogs/database/how-to-build-a-chat-application-with-amazon-elasticache-for-redis/

对该文章的评论也很有趣。

Jacob Wakeem: What advantage this approach have over using aws iot? It seems that iot has all these functionality without writing a single line of code and with server-less architecture.

Sam Dengler: The managed PubSub feature in the AWS IoT service is also a good approach to message-based applications, like the one demonstrated in the article. With Elasticache (Redis), customers who use Pub/Sub are typically also using Redis as a data store for other use cases such as caching, leaderboards, etc. With that said, you could also use ElastiCache (Redis) with the AWS IoT service by triggering an AWS Lambda function via the AWS IoT rules engine. Depending on how the message-based application is architected and how the data is leveraged, one solution may be a better fit than the other.

关于amazon-web-services - AWS 相当于 Firebase 实时数据库的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39589636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com