Limit server-threads to cores in the machine
Former-commit-id: be3ba1d53eb070719fd84c7573f665277a35b6f4
This commit is contained in:
parent
6add662139
commit
d94984f96c
@ -35,7 +35,7 @@
|
|||||||
#include "latency.h"
|
#include "latency.h"
|
||||||
#include "atomicvar.h"
|
#include "atomicvar.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
#include <thread>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
@ -4986,11 +4986,17 @@ int main(int argc, char **argv) {
|
|||||||
(int)getpid());
|
(int)getpid());
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
serverLog(LL_WARNING, "Warning: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "sentinel" : "redis");
|
serverLog(LL_WARNING, "WARNING: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "sentinel" : "redis");
|
||||||
} else {
|
} else {
|
||||||
serverLog(LL_WARNING, "Configuration loaded");
|
serverLog(LL_WARNING, "Configuration loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (server.cthreads > (int)std::thread::hardware_concurrency()) {
|
||||||
|
serverLog(LL_WARNING, "WARNING: server-threads is greater than this machine's core count. Truncating to %u threads", std::thread::hardware_concurrency());
|
||||||
|
server.cthreads = (int)std::thread::hardware_concurrency();
|
||||||
|
server.cthreads = std::max(server.cthreads, 1); // in case of any weird sign overflows
|
||||||
|
}
|
||||||
|
|
||||||
server.supervised = redisIsSupervised(server.supervised_mode);
|
server.supervised = redisIsSupervised(server.supervised_mode);
|
||||||
int background = server.daemonize && !server.supervised;
|
int background = server.daemonize && !server.supervised;
|
||||||
if (background) daemonize();
|
if (background) daemonize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user