2.4单线程
单线程架构
redis在一个瞬间只会执行一条命令
redis使用单线程为什么还这么快?
纯内存,一条命令在内存中的响应时间大概是100ns
非阻塞IO
避免线程切换和竞态消耗
使用redis的注意事项
一次只执行一条命令
拒绝长(慢)命令,包括keys、flushall、flushdb、slow lua script、mutil/exec、operate big value(collection)
其实不是单线程
fysnc file descriptor或close file descriptor是另外启动线程来执行的
Last updated
Was this helpful?