mongodb redis_Redis vs MongoDB

mongodb redis

Before jumping to comparison, one should have an idea about Redis and MongoDB. For more detail refer to the official documentation of Redis and MongoDB.

在进行比较之前,应该先了解一下Redis和MongoDB。 有关更多详细信息,请参考RedisMongoDB的官方文档。

As per documentation,

根据文档

Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.

Redis是开放源代码(BSD许可)的内存中数据结构存储,用作数据库,缓存和消息代理。

MongoDB is a document database, which means it stores data in JSON-like documents.

MongoDB是一个文档数据库,这意味着它将数据存储在类似JSON的文档中。

So we can conclude, both are data storage and can be used interchangeably. Wait, there is a huge difference in their working and performance. Depending on the requirement, decide the best for your project.

因此,我们可以得出结论,两者都是数据存储,并且可以互换使用。 等等,它们的工作和性能有很大的不同。 根据需求,确定最适合您的项目。

Here are the differences between Redis and MongoDB in terms of working, performance, overheads:-

以下是Redis和MongoDB在工作,性能,开销方面的区别:

  1. Redis is an in-memory data storage that stores data in volatile memory i.e. RAM in key-value pairs and it’s very fast.

    Redis是一种内存中数据存储,可将数据存储在易失性内存(即RAM中的键值对)中,并且速度非常快。

    MongoDB data is stored on disk. Each mongo read call takes more time as it will be fetched from disk.

    MongoDB数据存储在磁盘上。 每个mongo读取调用都将花费更多时间,因为它将从磁盘中获取。

  2. Redis is faster while using key-value pair data i.e. when it’s needed to get and set some data using a key.

    使用键值对数据时,即需要使用键来获取和设置一些数据时,Redis更快。

    MongoDB is faster in storing, fetching, and updating complex and highly nested JSON documents.

    MongoDB在存储,获取和更新复杂且高度嵌套的JSON文档方面速度更快。

  3. Redis storage is directly dependent on the RAM of the server. Hence, data storage capacity is limited. In such a case, clustering will need to be implemented, which is tedious, and must be done manually.

    Redis存储直接取决于服务器的RAM。 因此,数据存储容量是有限的 在这种情况下,将需要实施集群,这很繁琐,并且必须手动完成。

    In MongoDB, We can automatically configure data across several servers. MongoDB is faster when data is huge and nested since Redis will not be able to persist lots of data due to RAM utilization.

    在MongoDB中,我们可以跨多个服务器自动配置数据。 当数据庞大且嵌套时,MongoDB更快,因为Redis由于RAM利用率而无法持久存储大量数据。

  4. Redis has better data structure availability. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, geospatial indexes with radius queries, and streams.

    Redis具有更好的数据结构可用性。 它支持数据结构,例如字符串,哈希,列表,集合,带范围查询的排序集,位图,带半径查询的地理空间索引以及流。

    MongoDB, on the other hand, has a persistent kind of structure.

    另一方面,MongoDB具有持久的结构。

  5. Redis acts as an efficient cache mechanism, but choosing redis as a database requires additional overheads.

    Redis是一种有效的缓存机制,但是选择 redis作为数据库需要额外的开销。

    MongoDB is a

    MongoDB是一个

    complete database with automatic sharding and replication features.

    具有自动分片和复制功能的完整数据库

So depending on the use case, you can decide what’s your choice :)

因此,根据用例,您可以决定选择什么:)

翻译自: https://medium.com/swlh/redis-vs-mongodb-b29703c89dce

mongodb redis

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值