MongoDB and redis (unfinished)

Source: Internet
Author: User

MongoDB:

1) Document Database

MongoDB adopts bson for documentation. For example, you can design blog articles and comments as follows:

{'Id': 1, 'author': 'ningoo ', 'title': 'vernacular MongoDB (1)', 'content': 'according to the official statement, 10 thousand words are omitted here, comment: [{'comment-author': 'song bingjia ', 'comment-content': 'wood you'}, {'comment-author ': 'nyma', 'comment-content': 'Sorry, '}]}
Like a structure above, a document is equivalent to a row of records in a relational database. Multiple documents form a collection, which is equivalent to a table in a relational database.
Multiple collections are logically organized together, that is, databases. A MongoDB instance supports multiple databases ).
This structure leads to a large storage overhead, and the size of data stored in 1 GB is several GB.
2) B + Tree Index

redis:
Redis is essentially a key-value type memory database, similar to memcached. The entire database is loaded into the memory for operations,
Regularly flush database data to the hard disk for storage through asynchronous operations. Because it is a pure memory operation, redis has excellent performance,
The biggest charm of redis is that it supports saving the data structure of list linked lists and set sets, and also supports various operations on List, such as pushing and POP data from both ends of list,
Returns the list range, sorting, and so on. Set supports the Union and intersection operations of various sets. In addition, the maximum value of a single value is 1 GB,
Unlike memcached, which can only store 1 MB of data, redis can be used to implement many useful functions, such as using its list as a FIFO two-way linked list,
Implement a lightweight high-performance Message Queue Service, and use its set to implement a high-performance tag system. In addition, redis can also
Key-value can be used as an enhanced memcached.
1) Key and value Databases
2) hash index data, data operations in the memory (supporting application-level VMS), and regular implementation.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.