From 079f18ad9738694f46498a9ec0b24de14777943e Mon Sep 17 00:00:00 2001 From: Shivshankar Date: Thu, 10 Oct 2024 11:46:09 -0400 Subject: [PATCH] Add io-threads-do-reads config to deprecated config table to have no effect. (#1138) this fixes: https://github.com/valkey-io/valkey/issues/1116 _Issue details from #1116 by @zuiderkwast_ > This config is undocumented since #758. The default was changed to "yes" and it is quite useless to set it to "no". Yet, it can happen that some user has an old config file where it is explicitly set to "no". The result will be bad performace, since I/O threads will not do all the I/O. > > It's indeed confusing. > > 1. Either remove the whole option from the code. And thus no need for documentation. _OR:_ > 2. Introduce the option back in the configuration, just as a comment is fine. And showing the default value "yes": `# io-threads-do-reads yes` with additional text. > > _Originally posted by @melroy89 in [#1019 (reply in thread)](https://github.com/orgs/valkey-io/discussions/1019#discussioncomment-10824778)_ --------- Signed-off-by: Shivshankar-Reddy --- src/config.c | 2 +- src/io_threads.c | 1 - src/server.h | 1 - tests/unit/introspection.tcl | 1 - valkey.conf | 6 +++++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 62ed5dd91c..663cf5da38 100644 --- a/src/config.c +++ b/src/config.c @@ -445,6 +445,7 @@ void loadServerConfigFromString(char *config) { {"list-max-ziplist-entries", 2, 2}, {"list-max-ziplist-value", 2, 2}, {"lua-replicate-commands", 2, 2}, + {"io-threads-do-reads", 2, 2}, {NULL, 0}, }; char buf[1024]; @@ -3087,7 +3088,6 @@ standardConfig static_configs[] = { /* Bool configs */ createBoolConfig("rdbchecksum", NULL, IMMUTABLE_CONFIG, server.rdb_checksum, 1, NULL, NULL), createBoolConfig("daemonize", NULL, IMMUTABLE_CONFIG, server.daemonize, 0, NULL, NULL), - createBoolConfig("io-threads-do-reads", NULL, DEBUG_CONFIG | IMMUTABLE_CONFIG, server.io_threads_do_reads, 1, NULL, NULL), /* Read + parse from threads */ createBoolConfig("always-show-logo", NULL, IMMUTABLE_CONFIG, server.always_show_logo, 0, NULL, NULL), createBoolConfig("protected-mode", NULL, MODIFIABLE_CONFIG, server.protected_mode, 1, NULL, NULL), createBoolConfig("rdbcompression", NULL, MODIFIABLE_CONFIG, server.rdb_compression, 1, NULL, NULL), diff --git a/src/io_threads.c b/src/io_threads.c index 5b2230f635..b0368cf07b 100644 --- a/src/io_threads.c +++ b/src/io_threads.c @@ -319,7 +319,6 @@ void initIOThreads(void) { int trySendReadToIOThreads(client *c) { if (server.active_io_threads_num <= 1) return C_ERR; - if (!server.io_threads_do_reads) return C_ERR; /* If IO thread is areadty reading, return C_OK to make sure the main thread will not handle it. */ if (c->io_read_state != CLIENT_IDLE) return C_OK; /* Currently, replica/master writes are not offloaded and are processed synchronously. */ diff --git a/src/server.h b/src/server.h index 84ce96a49a..29d675bb18 100644 --- a/src/server.h +++ b/src/server.h @@ -1745,7 +1745,6 @@ struct valkeyServer { _Atomic uint64_t next_client_id; /* Next client unique ID. Incremental. */ int protected_mode; /* Don't accept external connections. */ int io_threads_num; /* Number of IO threads to use. */ - int io_threads_do_reads; /* Read and parse from IO threads? */ int active_io_threads_num; /* Current number of active IO threads, includes main thread. */ int events_per_io_thread; /* Number of events on the event loop to trigger IO threads activation. */ int prefetch_batch_max_size; /* Maximum number of keys to prefetch in a single batch */ diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index 286b02b7d0..352f5f183e 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -514,7 +514,6 @@ start_server {tags {"introspection"}} { set skip_configs { rdbchecksum daemonize - io-threads-do-reads tcp-backlog always-show-logo syslog-enabled diff --git a/valkey.conf b/valkey.conf index 9793d7825e..07cd293a0c 100644 --- a/valkey.conf +++ b/valkey.conf @@ -1357,7 +1357,11 @@ lazyfree-lazy-user-flush yes # # prefetch-batch-max-size 16 # -# NOTE: If you want to test the server speedup using valkey-benchmark, make +# NOTE: +# 1. The 'io-threads-do-reads' config is deprecated and has no effect. +# It will be removed in the future. Please avoid using this option if possible. +# +# 2. If you want to test the server speedup using valkey-benchmark, make # sure you also run the benchmark itself in threaded mode, using the # --threads option to match the number of server threads, otherwise you'll not # be able to notice the improvements.