redis is single-threaded why so fast

1, redis is a single-threaded why so fast

1) based entirely on memory, most of the requests is pure memory operation, very fast.

Simple 2) data structure, the data operation is simple, Redis data structure is designed to be compatible.

3) single-threaded, to avoid unnecessary context switches and competitive conditions, there is no multi-process or multi-threaded switch lead is consumed CPU, do not have to consider a variety of lock problems, there is no lock to release the lock operation, no because the possible deadlocks caused by the performance of consumption.

4) the use of multiple I / O multiplexing model, nonblocking IO

5) use different underlying model, the underlying application protocol between them to achieve communication between the client and the way is not the same, Redis VM build their own direct mechanism, because, then, will waste some time to move the general system call system function and requests.


Guess you like

Origin www.cnblogs.com/guoyu1/p/12353168.html