遇到好幾次同事和朋友問“redis是線程(進程)安全嗎?”
Redis is a single-threaded server. It is not designed to benefit from multiple CPU cores. People are supposed to launch several Redis instances to scale out on several cores if needed. It is not really fair to compare one single Redis instance to a multi-threaded data store.so as every command gets queued in a single thread you should be ok as there will never be two commands executing in parallel
翻譯:redis是單線程服務器。它的設計並不能從多核cpu中受益。人們可以安裝多個redis實例來提高多核cpu的利用率。拿redis更多線程存儲服務器做對比是不公平的。每個請求被緩存在一個線程中,一個時間只能有一個線程在處理請求。
參考文獻:http://stackoverflow.com/questions/11658272/is-redis-list-or-set-pop-method-thread-safe
