Posts

Showing posts with the label Redis

How fast is Redis? Why is Redis fast?

Image
How fast is Redis? Redis uses a memory-based KV database with a single-process single-thread model, written in C. The official data provided is a QPS (queries per second) that can reach 100,000+. This data is not worse than the same memory-based KV database Memcached with single-process multi-threading! Why is it so fast? 1. Based entirely on memory , most requests are pure memory operations, very fast. Data stored in memory; 2. The data structure is simple , and the data operation is also simple. The data structure in Redis is specially designed; 3. Single thread is used to avoid unnecessary context switching and race conditions. There is no multi-process or multi-threaded switching that consumes CPU. There is no need to consider various locks. There is no lock release operation. Performance consumption due to possible deadlocks; 4. Use multiple I / O multiplexing model, non-blocking IO ; "Multiple" here refers to multiple network connections, and "multiplex...