mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user