Skip to content

Commit e56fc7c

Browse files
committed
rpc: increase the defaults for -rpcthreads and -rpcworkqueue
`rpcthreads` was introduced with a default of 4 in 2013 in 21eb5ad `rpcworkqueue` was introduced with a default of 16 in 2015 in 40b556d Resolves: bitcoin/bitcoin#29386
1 parent 6463117 commit e56fc7c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/httpserver.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,17 @@ namespace util {
1414
class SignalInterrupt;
1515
} // namespace util
1616

17-
static const int DEFAULT_HTTP_THREADS=4;
18-
static const int DEFAULT_HTTP_WORKQUEUE=16;
17+
/**
18+
* The default value for `-rpcthreads`. This number of threads will be created at startup.
19+
*/
20+
static const int DEFAULT_HTTP_THREADS=16;
21+
22+
/**
23+
* The default value for `-rpcworkqueue`. This is the maximum depth of the work queue,
24+
* we don't allocate this number of work queue items upfront.
25+
*/
26+
static const int DEFAULT_HTTP_WORKQUEUE=64;
27+
1928
static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;
2029

2130
struct evhttp_request;

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
664664
argsman.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC);
665665
argsman.AddArg("-rpcwhitelist=<whitelist>", "Set a whitelist to filter incoming RPC calls for a specific user. The field <whitelist> comes in the format: <USERNAME>:<rpc 1>,<rpc 2>,...,<rpc n>. If multiple whitelists are set for a given user, they are set-intersected. See -rpcwhitelistdefault documentation for information on default whitelist behavior.", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
666666
argsman.AddArg("-rpcwhitelistdefault", "Sets default behavior for rpc whitelisting. Unless rpcwhitelistdefault is set to 0, if any -rpcwhitelist is set, the rpc server acts as if all rpc users are subject to empty-unless-otherwise-specified whitelists. If rpcwhitelistdefault is set to 1 and no -rpcwhitelist is set, rpc server acts as if all rpc users are subject to empty whitelists.", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
667-
argsman.AddArg("-rpcworkqueue=<n>", strprintf("Set the depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
667+
argsman.AddArg("-rpcworkqueue=<n>", strprintf("Set the maximum depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC);
668668
argsman.AddArg("-server", "Accept command line and JSON-RPC commands", ArgsManager::ALLOW_ANY, OptionsCategory::RPC);
669669
if (can_listen_ipc) {
670670
argsman.AddArg("-ipcbind=<address>", "Bind to Unix socket address and listen for incoming connections. Valid address values are \"unix\" to listen on the default path, <datadir>/node.sock, or \"unix:/custom/path\" to specify a custom path. Can be specified multiple times to listen on multiple paths. Default behavior is not to listen on any path. If relative paths are specified, they are interpreted relative to the network data directory. If paths include any parent directory components and the parent directories do not exist, they will be created.", ArgsManager::ALLOW_ANY, OptionsCategory::IPC);

0 commit comments

Comments
 (0)