Redis-related
The difference between 1.Memcache and Redis
Storage mode
Memecache all of the data in memory, after the power outage will be suspended, the data can not exceed the memory size.
Redis is partially present on the hard drive, which guarantees the data's durability.
Types of data support
Memcache support for data types is relatively straightforward.
Redis has complex data types.
Use the underlying model differently
They are not the same as the underlying implementation and the application protocols that communicate with the client.
Redis builds its own VM mechanism directly, because the normal system calls system functions, it wastes a certain amount of time to move and request.
MongoDB Related
Principle of 1.mongodb persistence
MongoDB and MySQL different, every update of MySQL will be written directly to the hard disk, but MONGO not, as a memory database, data operations will be written to memory, and then persist to the hard disk, then MONGO is how to persist?
When MongoDB starts, it initializes a thread that is constantly looping (unless the app crash) to fetch the data to be persisted from the defer queue for a certain time period and write to the journal (log) and Mongofile (data) of the disk. Of course, because it's not written to disk when the user adds a record, as the MongoDB developer says, it does not cause performance loss because it has seen code discovery, and when the cud operation is logged (record type) are put into the defer queue for delay batch (GROUPCOMMIT) commit write, but believe that the time period parameter is a parameter to be carefully considered, the system is 90 milliseconds, if the value is low, it may cause frequent disk operation, too high will cause system downtime data loss.
2. What is a NoSQL database? What is the difference between NoSQL and RDBMS? Under what circumstances are NoSQL databases used and not used?
NoSQL is a non-relational database, NoSQL = not-only SQL.
Relational databases use structured data that NoSQL uses to store data in the form of key-value pairs.
NoSQL databases are a priority when dealing with unstructured/semi-structured big data, when scaling horizontally, and when dealing with dynamically increasing data items.
When considering the maturity of the database, support, analysis and business intelligence, management and professional issues, priority should be given to relational databases.
What is the most basic difference between 3.MySQL and MongoDB?
The difference between a relational database and a non-relational database is that the data storage structure is different.
What is the characteristic of 4.MongoDB?
(1) Document-oriented (2) High performance (3) highly available (4) easy to expand (5) Rich query Language
Does 5.MongoDB support stored procedures? How do I use it if I support it?
MongoDB supports stored procedures, which are written by JavaScript and saved in the Db.system.js table.
6. How to understand the Gridfs mechanism in MongoDB, why does MongoDB use Gridfs to store files?
Gridfs is a file specification that stores large files in MongoDB. Gridfs can be used to separate large files into multiple small documents, so that we can effectively save large documents, and solve the problem that the Bson object is limited.
7. Why is MongoDB data file very large?
MongoDB uses a pre-allocated space way to prevent file fragmentation.
8. What happens when you update a document on a block (Chunk) that is being migrated?
The update operation occurs immediately on the old block (Chunk) before the change is replicated to the new shard before the transfer of ownership.
9.MongoDB index on A:{b,c}, query A:{b,c} and A:{c,b} will use the index?
No, the index is only used on a:{b,c}.
10. What happens if a shard (Shard) stops or is very slow, initiating a query?
If a shard is stopped, the query returns an error unless the query has the "Partial" option set. If a shard responds slowly, MongoDB waits for its response.
What is the reason 11.MongoDB becomes the best NoSQL database?
The following features make MongoDB the best NoSQL database:
FILE-oriented
Performance
High Availability
Ease of scalability
Rich Query Language
[Pen face] Redis/mongodb and other components related