Skip to content

Commit 940e6c7

Browse files
p3rf Teamcopybara-github
authored andcommitted
Redis IOThreads calculation: Make sure there is at least 1 IO thread per process.
PiperOrigin-RevId: 716396302
1 parent 1c3a4b2 commit 940e6c7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

perfkitbenchmarker/linux_benchmarks/redis_memtier_benchmark.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
memtier_pipeline: 1
7777
placement_group_style: none
7878
redis_aof: False
79-
redis_server_io_threads: 0
8079
vm_groups:
8180
servers:
8281
vm_spec: *default_dual_core

perfkitbenchmarker/linux_packages/redis_server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class RedisEvictionPolicy:
4343
None,
4444
'Only supported for redis version >= 6, the '
4545
'number of redis server IO threads to use.',
46+
lower_bound=1,
47+
upper_bound=128,
4648
)
4749
_IO_THREADS_DO_READS = flags.DEFINE_bool(
4850
'redis_server_io_threads_do_reads',
@@ -157,10 +159,11 @@ def _GetIOThreads(vm) -> int:
157159
return _IO_THREADS.value
158160
# Redis docs suggests that i/o threads should not exceed number of cores.
159161
nthreads_per_core = vm.CheckLsCpu().threads_per_core
162+
num_cpus = vm.NumCpusForBenchmark()
160163
if nthreads_per_core == 1:
161-
return vm.NumCpusForBenchmark() - 1
164+
return max(num_cpus - 1, 1)
162165
else:
163-
return vm.NumCpusForBenchmark() // 2
166+
return num_cpus // 2
164167

165168

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

0 commit comments

Comments
 (0)