speed improvements: change scheduler to SCHED_FIFO, Disable realtime throttling, use in-memory db for sqlite core channels table (set core-db-name to 'core' in switch.conf.xml for previous behaviour of using the core sqlite file, now only aliases will be in the persistant db)

This commit is contained in:
Anthony Minessale
2012-09-25 16:12:23 -05:00
parent 0fe6aa4d0a
commit dbf5153fb7
3 changed files with 68 additions and 2 deletions

View File

@@ -731,16 +731,36 @@ SWITCH_DECLARE(int32_t) set_realtime_priority(void)
* Try to use a round-robin scheduler
* with a fallback if that does not work
*/
int fd;
const char *rt = "/proc/sys/kernel/sched_rt_runtime_us";
char data[] = "-1\n";
struct sched_param sched = { 0 };
sched.sched_priority = 1;
if (sched_setscheduler(0, SCHED_RR, &sched)) {
if (sched_setscheduler(0, SCHED_FIFO, &sched)) {
sched.sched_priority = 0;
if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
return -1;
}
}
if ((fd = open(rt, O_WRONLY)) > 0) {
int r;
if (!(r = write(fd, data, sizeof(data)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Disablling RT limits [%s][%d]\n", rt, r);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Disabling RT throttling.\n");
}
close(fd);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening %s\n", rt);
}
#endif
#ifdef HAVE_SETPRIORITY
/*
* setpriority() works on FreeBSD (6.2), nice() doesn't