MongoDB 与 Redis
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12812502/
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
MongoDB v/s Redis
提问by Pradeep Banavara
Primary requirements:
主要要求:
- Clustering and replication support and hence easy and low cost deployment in cloud.
- Direct support for objects. Take out ORM from the equation.
- Python client.
- Read heavy and moderate writes.
- Need moderate speed but nothing like stock trading.
- 集群和复制支持,因此在云中部署简单且成本低。
- 直接支持对象。从等式中取出 ORM。
- Python客户端。
- 阅读重度和中度的写作。
- 需要中等速度,但不像股票交易那样。
回答by Pradeep Banavara
Based on this article
基于这篇文章
http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
I finally drilled down my database choices to Redisand MongoDBas they seem to satisfy most of the requirements. I'll explain how I'm choosing the most appropriate one for my requirements.
我最终将我的数据库选择深入到Redis和MongoDB,因为它们似乎满足了大部分要求。我将解释我是如何选择最适合我的要求的。
- Clustering and replication support - Redis has little no support for clustering or replication. Hence your memory grows in proportion to your data. Since we are using a cloud based infrastructure - the costs could be substantial in supporting that kind of a memory. MongoDB on the other hand supports replication and clustering. Redis 0 MongoDB 1.
- Direct support for objects - No ORM : Here clearly Redis is a winner as it supports a memcached like model. However, MongoDB also offers an 'object like storage' and direct support for JSON. So if I could sacrifice the speed requirements MongoDB does satisfy this need. Redis 1 MongoDB 1.
- Python client - both the databases have robust python clients. Redis 1 MongoDb 1.
- Read heavy and moderate writes - I don't think there is a distinctive difference in read performance against both these dbs. However only experience will say. For the time being - I'm giving equal scoring for both. Redis 1 MongoDB 1.
- Don't need stock trading like speed - Clearly MongoDB has an edge here. Redis 0 MongoDB 1.
- 集群和复制支持 - Redis 几乎不支持集群或复制。因此,您的内存与您的数据成比例增长。由于我们使用的是基于云的基础设施——支持这种内存的成本可能很高。另一方面,MongoDB 支持复制和集群。Redis 0 MongoDB 1。
- 对对象的直接支持 - 无 ORM:这里很明显 Redis 是赢家,因为它支持类似 memcached 的模型。然而,MongoDB 也提供了“像存储这样的对象”和对 JSON 的直接支持。因此,如果我可以牺牲速度要求,MongoDB 确实可以满足这种需求。Redis 1 MongoDB 1.
- Python 客户端 - 两个数据库都有强大的 Python 客户端。Redis 1 MongoDb 1。
- 读取重度和中度写入 - 我认为这两个数据库的读取性能没有明显差异。然而,只有经验会说。就目前而言 - 我对两者给予同等的评分。Redis 1 MongoDB 1.
- 不需要像速度那样的股票交易 - 显然 MongoDB 在这里有优势。Redis 0 MongoDB 1。
Total score : Redis 3 MongoDB 5.
总分:Redis 3 MongoDB 5。
For now I'm gonna go with MongoDB. As an added bonus MongoDB also has geospatial query support. So if for whatever reason I have to add location based querying to my app, it shouldn't be really hard to make that transition with MongoDB. Let's see how things map out. I hope to come back some day and revisit this answer :). Please feel free to add anything that I've missed.
现在我要使用 MongoDB。作为额外的奖励,MongoDB 还具有地理空间查询支持。因此,如果出于某种原因我必须将基于位置的查询添加到我的应用程序中,那么使用 MongoDB 进行这种转换应该并不难。让我们看看事情是如何发展的。我希望有一天能回来并重新审视这个答案:)。请随意添加我遗漏的任何内容。

