Amazon SQS 汇集数据库写入

发布于 2024-10-04 16:20:39 字数 200 浏览 1 评论 0原文

假设我正在构建 netflix,并且我想通过 userID 和电影 ID 记录每个视图,

格式为 viewID 、 userID 、时间戳,

但是为了扩展此范围,假设每秒获得 1000 个视图。将这些视图排队到SQS,然后我们的队列读取器可以一一取消排队并将其写入mysql数据库是否有意义。这样数据库就不会因写入请求而过载。

这看起来有用吗?

Assume I am building netflix and I want to log each view by the userID and the movie ID

The format would be viewID , userID, timestamp,

However in order to scale this, assume were getting 1000 views a second. Would it make sense to queue these views to SQS and then our queue readers can un-queue one by one and write it to the mysql database. This way the database is not overloaded with write requests.

Does this look like something that would work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平生欢 2024-10-11 16:20:39

Faisal,

这是一个合理的架构;但是,您应该知道写入 SQS 比写入 RabbitMQ(或任何本地)消息队列慢很多倍。

默认情况下,SQS FIFO 队列支持每秒最多 3,000 条消息(带批处理),或最多每秒 300 条消息(每秒 300 次发送、接收或删除操作)。要请求增加限制,您需要提交支持请求。

话虽如此,从 SQS 开始并不是一个坏主意,因为它易于使用和调试。

此外,您可能想研究 MongoDB 的日志记录...查看以下参考资料:

MongoDB 非常适合日志记录

http://blog.mongodb.org/post/172254834/mongodb-is-fantastic-for-logging

上限集合< /strong>

http://blog.mongodb.org/post/116405435/capped-collections

使用 MongoDB 进行实时分析

http://blog.mongodb.org/post/171353301/using-mongodb-for-real-time-analytics

Faisal,

This is a reasonable architecture; however, you should know that writing to SQS is going to be many times slower than writing to something like RabbitMQ (or any local) message queue.

By default, SQS FIFO queues support up to 3,000 messages per second with batching, or up to 300 messages per second (300 send, receive, or delete operations per second) without batching. To request a limit increase, you need to file a support request.

That being said, starting with SQS wouldn't be a bad idea since it is easy to use and debug.

Additionally, you may want to investigate MongoDB for logging...check out the following references:

MongoDB is Fantastic for Logging

http://blog.mongodb.org/post/172254834/mongodb-is-fantastic-for-logging

Capped Collections

http://blog.mongodb.org/post/116405435/capped-collections

Using MongoDB for Real-time Analytics

http://blog.mongodb.org/post/171353301/using-mongodb-for-real-time-analytics

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文