From 30e84203429d322ff7845d93c8ad5b920cd563e5 Mon Sep 17 00:00:00 2001 From: "roberto@debian64" Date: Wed, 1 Feb 2012 16:07:29 +0100 Subject: [PATCH] added --cheaper-overload --- master.c | 2 +- uwsgi.c | 3 +++ uwsgi.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/master.c b/master.c index 99c13cd0..adaeb74c 100644 --- a/master.c +++ b/master.c @@ -653,7 +653,7 @@ int master_loop(char **argv, char **environ) { healthy: if (uwsgi.cheaper && !uwsgi.cheap && !uwsgi.to_heaven && !uwsgi.to_hell) { - if (overload_count > 3) { + if (overload_count > uwsgi.cheaper_overload) { // activate the first available worker int decheaped = 0; for (i = 1; i <= uwsgi.numproc; i++) { diff --git a/uwsgi.c b/uwsgi.c index ca343fab..d30d427b 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -276,6 +276,7 @@ static struct uwsgi_option uwsgi_base_options[] = { {"cheap", no_argument, 0, "set cheap mode (spawn workers only after the first request)", uwsgi_opt_true, &uwsgi.cheap, 0}, {"cheaper", required_argument, 0, "set cheaper mode (adaptive process spawning)", uwsgi_opt_set_int, &uwsgi.cheaper_count, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER}, {"cheaper-step", required_argument, 0, "number of additional processes to spawn at each overload", uwsgi_opt_set_int, &uwsgi.cheaper_step, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER}, + {"cheaper-overload", required_argument, 0, "increase workers after specified overload", uwsgi_opt_set_64bit, &uwsgi.cheaper_overload, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER}, {"idle", required_argument, 0, "set idle mode (put uWSGI in cheap mode after inactivity)", uwsgi_opt_set_int, &uwsgi.idle, 0}, {"die-on-idle", no_argument, 0, "shutdown uWSGI when idle", uwsgi_opt_true, &uwsgi.die_on_idle, 0}, {"mount", required_argument, 0, "load application under mountpoint", uwsgi_opt_add_app, NULL,0}, @@ -1172,6 +1173,8 @@ int main(int argc, char *argv[], char *envp[]) { uwsgi.async = 1; uwsgi.listen_queue = 100; + uwsgi.cheaper_overload = 3; + uwsgi.max_vars = MAX_VARS; uwsgi.vec_size = 4 + 1 + (4 * MAX_VARS); diff --git a/uwsgi.h b/uwsgi.h index 33d5d303..bf8ae6cc 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -981,6 +981,7 @@ struct uwsgi_server { // enable cheaper mode int cheaper; int cheaper_step; + uint64_t cheaper_overload; // minimal number of running workers in cheaper mode int cheaper_count; // enable idle mode