first of all, we know that MySQL is persistent storage, stored in the disk, retrieval, will involve a certain IO, in order to solve the bottleneck, so there is a cache, such as the current use of the most memcached (referred to as MC).
First, the user accesses the MC, if not hit, to access MySQL, and then like memory and hard disk, the data copied to the MC part of the Redis and MC are cached, and all reside in memory running, which greatly improves the access speed of high data volume Web Access.
However, MC simply provides a simple data structure, such as string storage, and Redis provides a large number of data structures, such as String, list, set, HashSet, sorted set these, which makes the user convenient a lot of, after all, encapsulated a layer of practical functions, at the same time
Achieve the same effect, of course, using Redis and slowly discard MC. Memory and hard disk relationship, hard disk placement principal data for persistent storage, and memory is currently running part of the data, CPU access to memory rather than disk, which greatly increased the speed of operation,
This is, of course, based on the local access principle of the program. Reasoning to Redis+mysql, it is a mapping of memory + disk relationships, MySQL placed on disk, Redis placed in memory, so that the Web app accesses only Redis at a time, and if no data is found, it accesses MySQL.
However, the use of redis+mysql and memory + disks is best different.
Why is it faster to access a cache database such as Redis?