redis / redis

Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.

Home Page:http://redis.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUESTION] redis threaded io polling mode

lorneli opened this issue · comments

It looks like redis implements threaded io in polling mode. IO thread loops in while(1) way. At the beginning of each loop, it calls getIOPendingCount 1000000 times(or less times if pending_count != 0). So, io thread is basically implemented in polling mode, which costs much cpu wasting.

Another possible implementation is to wake up(condition notify) io thread when main thread finds out there are waiting clients. IO thread handles clients read/write and blocks on the condition variable.

I wonder if there was more consideration about current polling mode implement. Thanks.