Skip to content

Commit

Permalink
Allow specifying auto scaling profile with udp_workers
Browse files Browse the repository at this point in the history
  • Loading branch information
danpascu committed Apr 30, 2019
1 parent 80ce8f9 commit 04175e5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cfg.y
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions globals.h
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions main.c
Expand Up @@ -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 */
Expand Down
8 changes: 8 additions & 0 deletions socket_info.c
Expand Up @@ -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;
Expand Down

0 comments on commit 04175e5

Please sign in to comment.