update core sql for some speed tuning

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7581 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-02-11 16:49:07 +00:00
parent 657b380452
commit 217a70e4e0
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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);