什么时候使用Redis?什么时候使用 MongoDB? [英] When to Redis? When to MongoDB?

查看:78
本文介绍了什么时候使用Redis?什么时候使用 MongoDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的不是Redis和MongoDB的比较.我知道他们是不同的;性能和 API 完全不同.

What I want is not a comparison between Redis and MongoDB. I know they are different; the performance and the API is totally different.

Redis 非常快,但 API 非常原子".MongoDB会吃更多的资源,但是API非常非常好用,我很满意.

Redis is very fast, but the API is very 'atomic'. MongoDB will eat more resources, but the API is very very easy to use, and I am very happy with it.

它们都很棒,我想在部署中尽可能多地使用 Redis,但是很难编码.我想在开发中尽可能多地使用MongoDB,但它需要一台昂贵的机器.

They're both awesome, and I want to use Redis in deployment as much as I can, but it is hard to code. I want to use MongoDB in development as much as I can, but it needs an expensive machine.

那么你如何看待两者的使用?什么时候选择Redis?什么时候选择 MongoDB?

So what do you think about the use of both of them? When to pick Redis? When to pick MongoDB?

推荐答案

我想说,这取决于您所在的开发团队类型以及您的应用程序需求.

I would say, it depends on kind of dev team you are and your application needs.

例如,如果您需要大量查询,这主要意味着您的开发人员使用 Redis 会做更多的工作,您的数据可能存储在各种专门的数据结构中,定制的为每种类型的对象提高效率.在 MongoDB 中,相同的查询可能更容易,因为结构在您的数据中更加一致.另一方面,在 Redis 中,对这些查询的绝对速度是处理数据可能使用的各种结构的额外工作的回报.

For example, if you require a lot of querying, that mostly means it would be more work for your developers to use Redis, where your data might be stored in variety of specialized data structures, customized for each type of object for efficiency. In MongoDB the same queries might be easier because the structure is more consistent across your data. On the other hand, in Redis, sheer speed of the response to those queries is the payoff for the extra work of dealing with the variety of structures your data might be stored with.

MongoDB 为具有传统 DB 和 SQL 经验的开发人员提供了简单性和更短的学习曲线.但是,Redis 的非传统方法需要更多的努力来学习,但需要更大的灵活性.

MongoDB offers simplicity, much shorter learning curve for developers with traditional DB and SQL experience. However, Redis's non-traditional approach requires more effort to learn, but greater flexibility.

例如.缓存 层可能可以更好地在 Redis 中实现.对于更多模式化数据,MongoDB 更好.[注意:MongoDB 和 Redis 在技术上都是无模式的]

Eg. A cache layer can probably be better implemented in Redis. For more schema-able data, MongoDB is better. [Note: both MongoDB and Redis are technically schemaless]

如果你问我,我个人的选择是满足大多数需求的 Redis.

If you ask me, my personal choice is Redis for most requirements.

最后,我希望你现在已经看过 http://antirez.com/post/MongoDB-and-Redis.html

Lastly, I hope by now you have seen http://antirez.com/post/MongoDB-and-Redis.html

这篇关于什么时候使用Redis?什么时候使用 MongoDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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