Home > Database > Redis > body text

The difference between redis and mongodb

(*-*)浩
Release: 2019-06-17 15:58:29
Original
8344 people have browsed it

Redis

Redis is an open source log-type, Key-Value database written in ANSI C language, supports network, can be based on memory and can be persisted, and Provides APIs in multiple languages.

The difference between redis and mongodb

#redis is a key-value storage system. Similar to Memcached, it supports relatively more stored value types, including string (string), list (linked list), set (set), zset (sorted set - ordered set) and hash (hash type). (Recommended learning: Redis Video Tutorial)

These data types all support push/pop, add/remove, intersection, union, difference and richer operations, and these operations are It's atomic. On this basis, redis supports various different ways of sorting. Like memcached, data is cached in memory to ensure efficiency. The difference is that redis will periodically write updated data to disk or write modification operations to additional record files, and on this basis, master-slave (master-slave) synchronization is achieved.

mongoDB

mongoDB is a document database. Let me first explain the document database, which can store data of xml, json, and bson types.

These data are self-describing and present a hierarchical tree-like data structure. Redis can use hash to store simple relational data.

mongoDB stores json format data.

Suitable scenarios: event recording, content management or blogging platforms, such as comment systems.

Difference

The size of the memory space and the size of the data

redis added its own VM after version 2.0 Features, breaking through the limitations of physical memory; you can set the expiration time for the key value (similar to memcache)

mongoDB is suitable for storage of large amounts of data. It relies on the operating system VM for memory management and consumes memory. Do not use services with Other services together

Data consistency (transaction support)

Redis transaction support is relatively weak and can only ensure that each operation in the transaction is executed continuously

mongoDB does not support transactions

Application scenarios

redis: more performance operations and calculations with smaller data volumes

MongoDB: main solution Massive data access efficiency issues

For more Redis-related technical articles, please visit the Redis database usage tutorial column to learn!

The above is the detailed content of The difference between redis and mongodb. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!