我创建多个进程去同时读取redis做的消息队列 请问这个会发生读取冲突么? 原因是什么呢?
天蓬老师2017-04-27 09:05:23
Redis itself guarantees mutual exclusion of queue reading and writing. Redis is single-threaded and works roughly like this. Your multi-process reading can actually send multiple read request packets in parallel. These request packets arrive in the socket buffer of redis. The processing of redis is to respond to your request serially without locks. If redis is changed to multi-threading one day, you can also lock the mutex to ensure that nothing happens when reading the queue.