提交 217a70e4 authored 作者: Anthony Minessale's avatar Anthony Minessale

update core sql for some speed tuning

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7581 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 657b3804
......@@ -78,7 +78,7 @@ typedef apr_os_thread_t switch_thread_id_t;
#define SWITCH_EVENT_QUEUE_LEN 256
#define SWITCH_MESSAGE_QUEUE_LEN 256
#define SWITCH_SQL_QUEUE_LEN 2000
#define SWITCH_SQL_QUEUE_LEN 100000
#define SWITCH_BUFFER_BLOCK_FRAMES 25
#define SWITCH_BUFFER_START_FRAMES 50
......
......@@ -154,6 +154,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread,
char *tmp, *sqlbuf = (char *) malloc(sql_len);
char *sql;
switch_size_t newlen;
int lc = 0;
switch_assert(sqlbuf);
......@@ -211,6 +212,11 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread,
*sqlbuf = '\0';
}
if (++lc == 300000) {
switch_core_db_exec(sql_manager.db, "vacuum;", NULL, NULL, NULL);
lc = 0;
}
if (nothing_in_queue) {
switch_yield(1000);
}
......@@ -394,6 +400,11 @@ void switch_core_sqldb_start(switch_memory_pool_t *pool)
switch_core_db_exec(sql_manager.db, "drop table calls", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, "drop table interfaces", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, "drop table tasks", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, "PRAGMA synchronous=OFF;", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, "PRAGMA count_changes=OFF;", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, "PRAGMA cache_size=8000", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, "PRAGMA temp_store=MEMORY;", NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, create_channels_sql, NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, create_calls_sql, NULL, NULL, NULL);
switch_core_db_exec(sql_manager.db, create_interfaces_sql, NULL, NULL, NULL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论