Make high pri time thread configurable

Former-commit-id: 7e94207765d2166f46792aea0919786f3f30d7b3
This commit is contained in:
Cloud User 2021-04-06 22:39:20 +00:00
parent 0b6a66ca55
commit 6601905d8c
4 changed files with 5 additions and 0 deletions

View File

@ -2535,6 +2535,7 @@ standardConfig configs[] = {
createBoolConfig("use-fork", NULL, IMMUTABLE_CONFIG, cserver.fForkBgSave, 0, NULL, NULL),
createBoolConfig("allow-write-during-load", NULL, MODIFIABLE_CONFIG, g_pserver->fWriteDuringActiveLoad, 0, NULL, NULL),
createBoolConfig("io-threads-do-reads", NULL, IMMUTABLE_CONFIG, fDummy, 0, NULL, NULL),
createBoolConfig("time-thread-priority", NULL, IMMUTABLE_CONFIG, cserver.time_thread_priority, 0, NULL, NULL),
/* String Configs */
createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, g_pserver->acl_filename, "", NULL, NULL),

View File

@ -6443,9 +6443,11 @@ int main(int argc, char **argv) {
serverAssert(cserver.cthreads > 0 && cserver.cthreads <= MAX_EVENT_LOOPS);
pthread_create(&cserver.time_thread_id, nullptr, timeThreadMain, nullptr);
if (cserver.time_thread_priority) {
struct sched_param time_thread_priority;
time_thread_priority.sched_priority = sched_get_priority_max(SCHED_FIFO);
pthread_setschedparam(cserver.time_thread_id, SCHED_FIFO, &time_thread_priority);
}
pthread_attr_t tattr;
pthread_attr_init(&tattr);

View File

@ -2000,6 +2000,7 @@ struct redisServerConst {
int storage_memory_model = STORAGE_WRITETHROUGH;
char *storage_conf = nullptr;
int fForkBgSave = false;
int time_thread_priority = false;
};
struct redisServer {

View File

@ -90,6 +90,7 @@ start_server {tags {"introspection"}} {
server_cpulist
bio_cpulist
aof_rewrite_cpulist
time-thread-priority
bgsave_cpulist
storage-cache-mode
storage-provider-options