AWS MySQL RDS 与 AWS DynamoDB

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13966368/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:51:36  来源:igfitidea点击:

AWS MySQL RDS vs AWS DynamoDB

mysqldatabaseamazon-web-servicesamazon-dynamodb

提问by Adam

I've been using MySQL for a fair while now and I'm comfortable with its structure & SQL Queries etc.

我已经使用 MySQL 一段时间了,我对它的结构和 SQL 查询等很满意。

Currently building a new system in AWS and I've been looking at DynamoDB. Currently I only know a little about it.

目前正在 AWS 中构建一个新系统,我一直在研究 DynamoDB。目前我只知道一点点。

Is one better then the other?

一个比另一个更好吗?

What are the advantage of DynamoDB?

DynamoDB 的优势是什么?

what is the transition like from MySQL queries etc to this flat style DB?

从 MySQL 查询等到这种扁平式数据库的过渡是什么?

采纳答案by Guy

You can read AWS explanation about it here.

您可以在此处阅读有关它的 AWS 说明。

In short, if you have mainly Lookupqueries (and not Join queries), DynamoDB (and other NoSQL DB) is better. If you need to handle a lot of data, you will be limited when using MySQL (and other RDBMS).

简而言之,如果您主要有Lookup查询(而不是 Join 查询),DynamoDB(和其他 NoSQL DB)会更好。如果您需要处理大量数据,那么在使用 MySQL(和其他 RDBMS)时会受到限制。

You can't reuse your MySQL queries nor your data schema, but if you spend the effort to learn NoSQL, you will add an important tool to your tool box. There are many cases where DynamoDB is giving the simplest solution.

您不能重复使用您的 MySQL 查询和数据模式,但是如果您努力学习 NoSQL,您将为您的工具箱添加一个重要的工具。在很多情况下,DynamoDB 提供了最简单的解决方案。

回答by Mike Brant

Really DynamoDB and MySQL are apples and oranges. DynamoDB is a NoSQL storage layer while MySQL is used for relational storage. You should pick what to use based on the actual needs of your application. In fact, some applications might be well served by using both.

真的 DynamoDB 和 MySQL 是苹果和橘子。DynamoDB 是一个 NoSQL 存储层,而 MySQL 用于关系存储。您应该根据应用程序的实际需要选择要使用的内容。事实上,某些应用程序可能通过同时使用两者而得到很好的服务。

If, for example, you are storing data that does not lend itself well to a relational schema (tree structures, schema-less JSON representations, etc.) that can be looked up against a single key or a key/range combination then DynamoDB (or some other NoSQL store) would likely be your best bet.

例如,如果您存储的数据不适合可针对单个键或键/范围组合查找的关系模式(树结构、无模式 JSON 表示等),则 DynamoDB(或其他一些 NoSQL 存储)可能是您最好的选择。

If you have a well-defined schema for your data that can fit well in a relational structure and you need the flexibility to query the data in a number of different ways (adding indexes as necessary of course), then RDS might be a better solution.

如果您有一个定义良好的数据架构,可以很好地适应关系结构,并且您需要灵活地以多种不同方式查询数据(当然,根据需要添加索引),那么 RDS 可能是更好的解决方案.

The main benefit for using DynamoDB as a NoSQL store is that you get guaranteed read/write throughput at whatever level you require without having to worry about managing a clustered data store. So if your application requires 1000 reads/writes per second, you can just provision your DynamoDB table for that level of throughput and not really have to worry about the underlying infrastructure.

使用 DynamoDB 作为 NoSQL 存储的主要好处是,您可以在所需的任何级别获得有保证的读/写吞吐量,而不必担心管理集群数据存储。因此,如果您的应用程序需要每秒 1000 次读/写,您只需为该级别的吞吐量预置 DynamoDB 表,而不必真正担心底层基础设施。

RDS has much of the same benefit of not having to worry about the infrastructure itself, however if you end up needing to do a significant number of writes to the point where the largest instance size will no longer keep up, you are kind of left without options (you can scale horizontally for reads using read replicas).

RDS 与不必担心基础架构本身具有许多相同的好处,但是,如果您最终需要进行大量写入,以至于最大的实例大小将不再跟上,那么您就没有办法了选项(您可以使用只读副本水平扩展读取)。

Updated note: DynamoDb does now support global secondary indexing, so you do now have the capability to perform optimized lookups on data fields other than the hash or combination of hash and range keys.

更新说明:DynamoDb 现在确实支持全局二级索引,因此您现在可以对除散列或散列键和范围键的组合以外的数据字段执行优化查找。

回答by Yami Glick

We have just migrated all of our DynamoDB tables to RDS MySQL.

我们刚刚将所有 DynamoDB 表迁移到 RDS MySQL。

While using DynamoDB for specific tasks may make sense, building a new system on top of DynamoDB is really a bad idea. Best laid plans etc., you always need that extra flexibility from your DB.

虽然将 DynamoDB 用于特定任务可能有意义,但在 DynamoDB 之上构建新系统确实是一个坏主意。最好的计划等,您总是需要从您的数据库中获得额外的灵活性。

Here are our reasons we moved from DynamoDB:

以下是我们从 DynamoDB 迁移的原因:

  1. Indexing - Changing or adding keys on-the-fly is impossible without creating a new table.
  2. Queries - Querying data is extremely limited. Especially if you want to query non-indexed data. Joins are of course impossible so you have to manage complex data relations on your code/cache layer.
  3. Backup - Such a tedious backup procedure is a disappointing surprise compared to the slick backup of RDS
  4. GUI - bad UX, limited search, no fun.
  5. Speed - Response time is problematic compared to RDS. You find yourself building elaborate caching mechanism to compensate for it in places you would have settled for RDS's internal caching.
  6. Data Integrity - While the concept of fluid data structure sounds nice to begin with, some of your data is better "set in stone". Strong typing is a blessing when a little bug tries to destroy your database. With DynamoDB anything is possible and indeed anything that can go wrong does.
  1. 索引 - 在不创建新表的情况下,动态更改或添加键是不可能的。
  2. 查询 - 查询数据极其有限。特别是如果您想查询非索引数据。联接当然是不可能的,因此您必须在代码/缓存层上管理复杂的数据关系。
  3. 备份 - 与 RDS 的流畅备份相比,如此繁琐的备份过程令人失望
  4. GUI - 糟糕的用户体验,有限的搜索,没有乐趣。
  5. 速度 - 与 RDS 相比,响应时间存在问题。您会发现自己正在构建精心设计的缓存机制,以在您本应采用 RDS 的内部缓存的地方对其进行补偿。
  6. 数据完整性 - 虽然流体数据结构的概念一开始听起来不错,但您的某些数据更好地“固定”。当一个小错误试图破坏您的数据库时,强类型是一种祝福。使用 DynamoDB,一切皆有可能,而且任何可能出错的事情都可能发生。

We now use DynamoDB as a backup for some systems and I'm sure we'll use it in the future for specific, well defined tasks. It's not a bad DB, it's just not the DB to serve 100% of your core system.

我们现在使用 DynamoDB 作为某些系统的备份,我相信我们将来会在特定的、定义明确的任务中使用它。这不是一个糟糕的数据库,它只是不是为您的核心系统提供 100% 服务的数据库。

As far as advantages go, I'd say Scalability and Durability. It scales incredibly and transparently and it's (sort of) always up. These are really great features, but they do not compensate in any way for the downside aspects.

就优势而言,我会说可扩展性和耐用性。它以令人难以置信的方式和透明的方式扩展,并且(某种程度上)始终向上。这些确实是很棒的功能,但它们并不能以任何方式弥补缺点。

回答by Ali

When using DynamoDB you should also know that the items/records in DynamoDB are limited to 400KB (See DynamoDB Limits). For many use cases this will not work. So DynamoDB will be good for few things but not all. Same goes for many of the other NoSQL database.

使用 DynamoDB 时,您还应该知道 DynamoDB 中的项目/记录限制为 400KB(请参阅DynamoDB 限制)。对于许多用例,这将不起作用。所以 DynamoDB 对少数事情有好处,但不是全部。许多其他 NoSQL 数据库也是如此。