[Freeswitch-svn] [commit] r7581 - in freeswitch/trunk/src: . include/private

Freeswitch SVN anthm at freeswitch.org
Mon Feb 11 11:49:08 EST 2008


Author: anthm
Date: Mon Feb 11 11:49:07 2008
New Revision: 7581

Modified:
   freeswitch/trunk/src/include/private/switch_core_pvt.h
   freeswitch/trunk/src/switch_core_sqldb.c

Log:
update core sql for some speed tuning

Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h
==============================================================================
--- freeswitch/trunk/src/include/private/switch_core_pvt.h	(original)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h	Mon Feb 11 11:49:07 2008
@@ -78,7 +78,7 @@
 
 #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

Modified: freeswitch/trunk/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/trunk/src/switch_core_sqldb.c	(original)
+++ freeswitch/trunk/src/switch_core_sqldb.c	Mon Feb 11 11:49:07 2008
@@ -154,6 +154,7 @@
 	char *tmp, *sqlbuf = (char *) malloc(sql_len);
 	char *sql;
 	switch_size_t newlen;
+	int lc = 0;
 
 	switch_assert(sqlbuf);
 
@@ -211,6 +212,11 @@
 			*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 @@
 		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);



More information about the Freeswitch-svn mailing list