Support configurable number of threads
This commit is contained in:
parent
84f38452e5
commit
f97f602f77
@ -1494,3 +1494,7 @@ rdb-save-incremental-fsync yes
|
||||
# the main dictionary scan
|
||||
# active-defrag-max-scan-fields 1000
|
||||
|
||||
# Number of worker threads serving requests. This number should be related to the performance
|
||||
# of your network hardware, not the number of cores on your machine. We don't recommend going
|
||||
# above 4 at this time. By default this is set 1.
|
||||
server-threads 2
|
||||
|
@ -830,6 +830,12 @@ void loadServerConfigFromString(char *config) {
|
||||
err = "KeyDB not compliled with scratch-file support.";
|
||||
goto loaderr;
|
||||
#endif
|
||||
} else if (!strcasecmp(argv[0],"server-threads") && argc == 2) {
|
||||
server.cthreads = atoi(argv[1]);
|
||||
if (server.cthreads <= 0 || server.cthreads > MAX_EVENT_LOOPS) {
|
||||
err = "Invalid number of threads specified";
|
||||
goto loaderr;
|
||||
}
|
||||
} else {
|
||||
err = "Bad directive or wrong number of arguments"; goto loaderr;
|
||||
}
|
||||
|
10
src/server.c
10
src/server.c
@ -4533,7 +4533,7 @@ void linuxMemoryWarnings(void) {
|
||||
serverLog(LL_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.");
|
||||
}
|
||||
if (THPIsEnabled()) {
|
||||
serverLog(LL_WARNING,"WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.");
|
||||
serverLog(LL_WARNING,"WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with KeyDB. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. KeyDB must be restarted after THP is disabled.");
|
||||
}
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
@ -5037,9 +5037,7 @@ int main(int argc, char **argv) {
|
||||
if (background) daemonize();
|
||||
|
||||
initServer();
|
||||
|
||||
server.cthreads = 1; //testing
|
||||
initNetworking(0 /* fReusePort */);
|
||||
initNetworking(server.cthreads > 1 /* fReusePort */);
|
||||
|
||||
if (background || server.pidfile) createPidFile();
|
||||
redisSetProcTitle(argv[0]);
|
||||
@ -5071,6 +5069,10 @@ int main(int argc, char **argv) {
|
||||
sentinelIsRunning();
|
||||
}
|
||||
|
||||
if (server.cthreads > 4) {
|
||||
serverLog(LL_WARNING, "Warning: server-threads is set to %d. This is above the maximum recommend value of 4, please ensure you've verified this is actually faster on your machine.", server.cthreads);
|
||||
}
|
||||
|
||||
/* Warning the user about suspicious maxmemory setting. */
|
||||
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
|
||||
serverLog(LL_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory);
|
||||
|
Loading…
x
Reference in New Issue
Block a user