Skip to content

Commit

Permalink
Redis IOThreads calculation: Make sure there is at least 1 IO thread …
Browse files Browse the repository at this point in the history
…per process.

PiperOrigin-RevId: 716396302
  • Loading branch information
p3rf Team authored and copybara-github committed Jan 16, 2025
1 parent 1c3a4b2 commit 940e6c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
memtier_pipeline: 1
placement_group_style: none
redis_aof: False
redis_server_io_threads: 0
vm_groups:
servers:
vm_spec: *default_dual_core
Expand Down
7 changes: 5 additions & 2 deletions perfkitbenchmarker/linux_packages/redis_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class RedisEvictionPolicy:
None,
'Only supported for redis version >= 6, the '
'number of redis server IO threads to use.',
lower_bound=1,
upper_bound=128,
)
_IO_THREADS_DO_READS = flags.DEFINE_bool(
'redis_server_io_threads_do_reads',
Expand Down Expand Up @@ -157,10 +159,11 @@ def _GetIOThreads(vm) -> int:
return _IO_THREADS.value
# Redis docs suggests that i/o threads should not exceed number of cores.
nthreads_per_core = vm.CheckLsCpu().threads_per_core
num_cpus = vm.NumCpusForBenchmark()
if nthreads_per_core == 1:
return vm.NumCpusForBenchmark() - 1
return max(num_cpus - 1, 1)
else:
return vm.NumCpusForBenchmark() // 2
return num_cpus // 2


def _BuildStartCommand(vm, port: int) -> str:
Expand Down

0 comments on commit 940e6c7

Please sign in to comment.