mongodb - 用于存储非关系数据的 AWS 数据库解决方案

标签 mongodb postgresql amazon-web-services amazon-dynamodb

满足以下要求的最佳 AWS 数据库是什么

  • 我需要在数据库中存储大约 50,000 - 1,00,000 个条目。
  • 每个条目都有一个字符串作为键,一个 Json 数组作为值。
  • 我应该能够使用 key 检索 JSON 数组。
  • JSON数据的大小在20-30KB左右
  • 我预计每小时大约有 10,000 - 40,000 次读取。
  • 大约 50,000 - 1,00,000 次写入/周
  • 我还必须考虑成本。
  • 易于集成/开发

我对 MongoDB、DynamoDB 和 PostgreSQL 有点困惑。请分享您对此的看法。

最佳答案

DynamoDB:-

DynamoDB 是一种完全托管的专有 NoSQL 数据库服务,支持键值和文档数据结构。对于您在 OP 中描述的典型用例,它可以达到目的。

DynamoDB can handle more than 10 trillion requests per day and support peaks of more than 20 million requests per second.

DynamoDB 具有适用于所有操作的良好 AWS SDK。 read and write capacity units可以为表格配置。

DynamoDB tables using on-demand capacity mode automatically adapt to your application’s traffic volume. On-demand capacity mode instantly accommodates up to double the previous peak traffic on a table. For example, if your application’s traffic pattern varies between 25,000 and 50,000 strongly consistent reads per second where 50,000 reads per second is the previous traffic peak, on-demand capacity mode instantly accommodates sustained traffic of up to 100,000 reads per second. If your application sustains traffic of 100,000 reads per second, that peak becomes your new previous peak, enabling subsequent traffic to reach up to 200,000 reads per second.

需要注意的一点是它不允许根据非键属性查询表。这意味着如果您不知道表的哈希键,您可能需要进行全表扫描才能获取数据。但是,有一个 Secondary Index 选项,您可以探索它来解决这个问题。在设计和做出明智的决定之前,您可能需要了解用例的所有查询访问模式

MongoDB:-

MongoDB不是 AWS 上的完全托管服务。但是,您可以使用 EC2、VPC、IAM、EBS 等 AWS 服务设置数据库。这需要一些 AWS 云经验才能设置数据库。另一种选择是使用 MongoDB Atlas service .

MongoDB 在查询方面更加灵活。此外,它还具有强大的聚合功能。有许多工具可用于直接查询数据库以探索 SQL 等数据。

就 Java API 而言,Spring MongoDB可用于执行典型的数据库操作。还有许多开源框架可用于 MongoDB 的各种语言(例如 Mongoose Nodejs)。

MongoDB支持多种编程语言,API也比较成熟。

PostgreSQL:-

PostgreSQL 是 AWS 上的一个完全托管的数据库。

PostgreSQL has become the preferred open source relational database for many enterprise developers and start-ups, powering leading geospatial and mobile applications. Amazon RDS makes it easy to set up, operate, and scale PostgreSQL deployments in the cloud.

我想我不需要写太多关于这个数据库和它的 API 的内容。它是非常成熟的数据库并具有良好的 API。

要考虑的要点:-

  1. 查询访问模式
  2. 设置简单
  3. 数据库维护
  4. API 和框架
  5. 社区支持

关于mongodb - 用于存储非关系数据的 AWS 数据库解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54034643/

相关文章:

amazon-web-services - Auth0 不适用于 Docker 容器 + Elastic beanstalk

mongodb - 如何更改 MongoDB 用户的密码?

postgresql - Postgres : Can I identify which tables are write-heavy in a schema using the statistics?

postgresql - 在 Postgres 中暂停事务

ruby-on-rails - pg_dump : "could not connect to server" in Rails "schema_format = :sql" migration

javascript - 试图从亚马逊 s3 调用外部样式表

java - 无法在 {tableName} 查询 Dynamo

node.js - Mongoose 查询内部文档数组

javascript - 带有 mongodb 点符号的变量

mongodb - 在主从 Mongo 数据库集中,如果您不小心写入了次级数据库,它会反射(reflect)在主数据库中吗?它会被路由到主数据库