mirror of https://git.kore.io/kore.git
Add new configuration option: worker_set_affinity.
Controls wether or not worker processes sets its affinity mask to bind themselves to a single CPU. Defaults to on (1).
This commit is contained in:
parent
b035dea3ff
commit
b0deac577c
|
@ -358,6 +358,7 @@ extern u_int8_t nlisteners;
|
|||
extern u_int64_t spdy_idle_time;
|
||||
extern u_int16_t cpu_count;
|
||||
extern u_int8_t worker_count;
|
||||
extern u_int8_t worker_set_affinity;
|
||||
extern u_int32_t worker_rlimit_nofiles;
|
||||
extern u_int32_t worker_max_connections;
|
||||
extern u_int32_t worker_active_connections;
|
||||
|
|
19
src/config.c
19
src/config.c
|
@ -45,6 +45,7 @@ static int configure_certkey(char **);
|
|||
static int configure_rlimit_nofiles(char **);
|
||||
static int configure_max_connections(char **);
|
||||
static int configure_accept_treshold(char **);
|
||||
static int configure_set_affinity(char **);
|
||||
static int configure_ssl_cipher(char **);
|
||||
static int configure_ssl_dhparam(char **);
|
||||
static int configure_ssl_no_compression(char **);
|
||||
|
@ -94,6 +95,7 @@ static struct {
|
|||
{ "worker_max_connections", configure_max_connections },
|
||||
{ "worker_rlimit_nofiles", configure_rlimit_nofiles },
|
||||
{ "worker_accept_treshold", configure_accept_treshold },
|
||||
{ "worker_set_affinity", configure_set_affinity },
|
||||
{ "pidfile", configure_pidfile },
|
||||
{ "accesslog", configure_accesslog },
|
||||
{ "certfile", configure_certfile },
|
||||
|
@ -591,6 +593,23 @@ configure_accept_treshold(char **argv)
|
|||
return (KORE_RESULT_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
configure_set_affinity(char **argv)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (argv[1] == NULL)
|
||||
return (KORE_RESULT_ERROR);
|
||||
|
||||
worker_set_affinity = kore_strtonum(argv[1], 10, 0, 1, &err);
|
||||
if (err != KORE_RESULT_OK) {
|
||||
printf("bad value for worker_set_affinity: %s\n", argv[1]);
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
return (KORE_RESULT_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
configure_http_header_max(char **argv)
|
||||
{
|
||||
|
|
|
@ -68,6 +68,7 @@ static struct wlock *accept_lock;
|
|||
extern volatile sig_atomic_t sig_recv;
|
||||
struct kore_worker *worker = NULL;
|
||||
struct connection_list worker_clients;
|
||||
u_int8_t worker_set_affinity = 1;
|
||||
u_int32_t worker_accept_treshold = 0;
|
||||
u_int32_t worker_rlimit_nofiles = 1024;
|
||||
u_int32_t worker_max_connections = 250;
|
||||
|
@ -231,7 +232,9 @@ kore_worker_entry(struct kore_worker *kw)
|
|||
|
||||
(void)snprintf(buf, sizeof(buf), "kore [wrk %d]", kw->id);
|
||||
kore_platform_proctitle(buf);
|
||||
kore_platform_worker_setcpu(kw);
|
||||
|
||||
if (worker_set_affinity == 1)
|
||||
kore_platform_worker_setcpu(kw);
|
||||
|
||||
kore_pid = kw->pid;
|
||||
|
||||
|
|
Loading…
Reference in New Issue