Database types for 1.mysql and Redis
MySQL is a relational database that is used primarily for persisting data, storing data on a hard disk, and reading slowly.
Redis is a nosql, non-relational database, is also a cache database, the data is stored in the cache, the cache read faster, can greatly improve the efficiency of operation, but save time is limited
Operating mechanism of 2.mysql
The relatively weak point of MySQL as a relational database for persistent storage is the presence of I/O operations on every request to access the database, if the database is accessed repeatedly and frequently. First: It will take a lot of time to link the database repeatedly, resulting in a slow running efficiency; second: repeated access to the database can also lead to excessive load on the database, then the concept of caching is derived.
3. Caching
The cache is the buffer of data exchange (cache), and when the browser executes the request, it first looks in the cache, gets it if it exists, or accesses the database.
The advantage of caching is that it reads faster
4.redis Database
The Redis database is a cache database for storing frequently used data, which reduces the number of accesses to the database and improves operational efficiency.
Summary of differences between 5.redis and MySQL
(1) Type
MySQL is a relational database from a type, and Redis is a cache database
(2) on the effect
MySQL for persistent storage of data to hard disk, powerful, but slow
Redis is used to store more frequent data into the cache and reads faster
(3) On demand
MySQL and Redis are generally used in conjunction because of different requirements.
The difference between MySQL and Redis