Briefly describe the difference between Redis and MySQL, and briefly describe redismysql
We know that mysql is a persistent storage and stored in a disk. Some IO is involved in retrieval. To solve this bottleneck, a cache occurs, for example, the most commonly used memcached (mc ). First, the user accesses mc. If it does not hit mysql, the user accesses mysql, and then copies the data to a part of mc like the memory and hard disk.
Redis and mc are both cached and run in the memory, which greatly improves the access speed for web access with high data volumes. However, mc only provides a simple data structure, such as string storage. redis provides a large number of data structures, such as string, list, set, hashset, and sorted set, this makes it much easier for users. After all, it encapsulates a practical layer of functions and achieves the same effect at the same time. Of course, it is easy to discard mc with redis.
The relationship between memory and hard disk. The main data stored on the hard disk is used for persistent storage, while the memory is the part of data currently running. The CPU accesses the memory instead of the disk, which greatly improves the running speed, of course, this is a program-based principle of local access.
Reasoning to redis + mysql, It is a ing of memory + disk relationships. mysql is put on disk and redis is put in memory. In this way, the web application only accesses redis at a time. If no data is found, to access Mysql.
However, the usage of redis + mysql and memory + disk is preferably different.
The former is a memory database, and the data is stored in the memory, of course, the speed is fast.
The latter is a relational database with powerful functions and slow data access.
Such as memcache, mongoDB, and Redis all belong to the No SQL series.
It is not a type of thing, and the application scenario is not the same. It depends on your needs.
Summary
The above is all about the differences between Redis and MySQL. If you are interested, refer: SQL and MySQL statement execution sequence analysis, several important MySQL variables, and differences between FIND_IN_SET () and IN Mysql. If you have any shortcomings, please leave a message to confirm. Hope to help you.