文档存储的最佳用途是什么? [英] What are the best uses of document stores?

查看:21
本文介绍了文档存储的最佳用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过很多关于像 CouchDB 这样的面向文档的数据存储.我了解 BigTable 的用途,例如 Cassandra 之类的商店.阅读这个问题后,我想知道条件会是什么值得使用文档存储吗?

解决方案

列族存储(例如 Bigtable 和 Cassandra)的查询能力非常有限.应用程序负责维护索引以查询更复杂的数据模型.

文档数据库允许您查询内容,而不仅仅是键.它还将为您管理索引,从而降低您的应用程序的复杂性.

域驱动设计 宣传了聚合和值对象的使用.Ayende 指出out,(复杂)聚合是非常自然的候选者,可以存储为单个文档,而不是在多个表或列族上对它们进行规范化.这将降低持久层的复杂性.相关数据分散在多个节点的可能性也较小,因为所有数据都包含在一个文档中.

如果您的应用程序需要存储多态对象,文档数据库也是一个不错的选择.当然,这也可以存储在 Cassandra 中,但您将没有那么多的查询功能.至少不是开箱即用的.

将文档数据库想象成一辆豪华跑车.它不需要专业的司机(阅读:复杂的应用程序)来让你从 A 到 B,它具有空调和舒适的座椅等功能,它会在可接受的时间内完成高扩展性的赛道.但是,如果您想在高可扩展性赛道上创下单圈记录,则需要专业的车手和高度优化的汽车(例如 Cassandra),但缺少空调等功能.>

I have been hearing a lot about document oriented data stores like CouchDB. I understand the uses of BigTable like stores such as Cassandra. After reading this question, I was wondering what the conditions would be to merit using a document store?

解决方案

Column-family stores such as Bigtable and Cassandra have very limited querying capabilities. The application is responsible for maintaining indexes in order to query a more complex data model.

Document databases allow you to query the content, not just the key. It will also manage the indexes for you, reducing the complexity of your application.

Domain-driven design evangelizes the use of aggregates and value objects. As Ayende points out, (complex) aggregates are very natural candidates to be stored as a single document, instead of normalizing them over multiple tables or column families. This will reduce the complexity of your persistence layer. There's also less chance that related data is scattered across multiple nodes, as all the data is contained in a single document.

If your application needs to store polymorphic objects, document databases are also a good candidate. Of course, this could also be stored in Cassandra, but you won't have as much querying capabilities. At least not out of the box.

Think of a document database as a luxurious sports car. It doesn't need a professional driver (read: complex application) to get you from A to B, it has features such as air conditioning and comfortable seats and it will lap the high-scalability track in an acceptable time. However, if you want to set a lap record on the high-scalability track, you will need a professional driver and a highly optimized car (e.g. Cassandra), which lacks features such as air conditioning.

这篇关于文档存储的最佳用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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