diff --git a/cfg.y b/cfg.y index f125a8f9ff3..b37a28e716e 100644 --- a/cfg.y +++ b/cfg.y @@ -829,6 +829,10 @@ assign_stm: DEBUG EQUAL snumber udp_workers_no=$3; } | CHILDREN EQUAL error { yyerror("number expected"); } | UDP_WORKERS EQUAL NUMBER { IFOR(); udp_workers_no=$3; } + | UDP_WORKERS EQUAL NUMBER USE_AUTO_SCALING_PROFILE ID { IFOR(); + udp_workers_no=$3; + udp_auto_scaling_profile=$5; + } | UDP_WORKERS EQUAL error { yyerror("number expected"); } | TIMER_WORKERS EQUAL NUMBER { IFOR(); timer_workers_no=$3; diff --git a/globals.h b/globals.h index 1e5f2c146a9..118537c669d 100644 --- a/globals.h +++ b/globals.h @@ -50,6 +50,7 @@ extern int auto_aliases; extern unsigned int maxbuffer; extern int udp_workers_no; +extern char *udp_auto_scaling_profile; extern enum poll_types io_poll_method; extern int auto_scaling_enabled; extern int auto_scaling_cycle; diff --git a/main.c b/main.c index 384277ec008..f3128061d27 100644 --- a/main.c +++ b/main.c @@ -197,6 +197,8 @@ unsigned int maxbuffer = MAX_RECV_BUFFER_SIZE; /* maximum buffer size we do be re-configured */ /* number of UDP workers processing requests */ int udp_workers_no = UDP_WORKERS_NO; +/* the global UDP auto scaling profile */ +char *udp_auto_scaling_profile = NULL; /* if the auto-scaling engine is enabled or not - this is autodetected */ int auto_scaling_enabled = 0; /* auto-scaling sampling and checking time cycle is 1 sec by default */ diff --git a/socket_info.c b/socket_info.c index ce73e26a625..fb7ed63a4b6 100644 --- a/socket_info.c +++ b/socket_info.c @@ -178,6 +178,14 @@ static struct socket_info* new_sock_info( struct socket_id *sid) } else { auto_scaling_enabled = 1; } + } else if (udp_auto_scaling_profile) { + si->s_profile = get_scaling_profile(udp_auto_scaling_profile); + if (si->s_profile==NULL) { + LM_WARN("scaling profile <%s> in udp_workers not defined " + "-> ignoring it...\n", udp_auto_scaling_profile); + } else { + auto_scaling_enabled = 1; + } } } return si;