Describe the bug
I want use the redis with io-threads, an my platform has 144 logical cpu cores, and in the redis.conf, I open the io-threads by setting "io-threads-do-reads yes",when the "io-threads <= 24", the redis-server can perform good as multi-threads, but when the "io-threads > 24", It become a single thread, what's wrong with it?
To reproduce
kernel:5.7.19
redis: 6.25
cpu: Icelake, 144 logical cores
redis-server:
taskset -c 0-23 redis-server --io-threads 24
redis-benchmark:
taskset -c 36-59 redis-benchmark -t set -n 500000000 -r 10000000 --threads 24
It can perfom good, but when I set:
redis-server:
taskset -c 0-24 redis-server --io-threads 25
redis-benchmark:
taskset -c 36-60 redis-benchmark -t set -n 500000000 -r 10000000 --threads 25
It becomes single thread now, why?
Expected behavior
A description of what you expected to happen.
Additional information
Any additional information that is relevant to the problem.
Comment From: sundb
@gxkevin How do you see it turning into a thread?
Comment From: tezc
https://github.com/redis/redis/blob/3f3f678a4741e6af18230ee1862d9ced7af79faf/src/networking.c#L3570
Probably, IO threads are stopped if pending < (server.io_threads_num*2). If that is the case, Redis decides there are not enough IO operations to justify IO threads usage and stops them until there are enough pending IO operations.
If you increase the client count in the benchmark (default is 50), e.g redis-benchmark -c 200, you will probably see multi thread usage back.
Comment From: sundb
Or you can use pstree -p pid to confirm that there is really only one thread left.
Comment From: gxkevin
https://github.com/redis/redis/blob/3f3f678a4741e6af18230ee1862d9ced7af79faf/src/networking.c#L3570
Probably, IO threads are stopped if
pending < (server.io_threads_num*2). If that is the case, Redis decides there are not enough IO operations to justify IO threads usage and stops them until there are enough pending IO operations.If you increase the client count in the benchmark (default is 50), e.g
redis-benchmark -c 200, you will probably see multi thread usage back.
yes, I also have found this reason, and now it can work succ. thanks
Comment From: gxkevin
solved