summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeunsik Lim <geunsik.lim@samsung.com>2017-05-17 10:14:54 +0900
committerGeunsik Lim <geunsik.lim@samsung.com>2017-05-17 10:14:54 +0900
commit7d07e8d040a8ef3b9e0240fea606fba7f5c53571 (patch)
tree97a89ee8daec63d41cc7b1a7e3dc3cddc62ebe19
parentfcb6ef20954db28f58d27c243fd628c13e96e22b (diff)
downloadmsg-service-7d07e8d040a8ef3b9e0240fea606fba7f5c53571.tar.gz
msg-service-7d07e8d040a8ef3b9e0240fea606fba7f5c53571.tar.bz2
msg-service-7d07e8d040a8ef3b9e0240fea606fba7f5c53571.zip
[MIC] msg-service-db: Speed up SQLite3 insertion operations while running MIC command
This commit is to speed up exeuction time of a MIC operation. The "INSERT INTO ..." operation has been taken more than 8 seconds when we run MIC command to make a Tizen platform image on the below system environment. - CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - Memory: DDR3 8GiB - OS: Ubuntu 14.04.5 LTS We don't need to keep the synchronous operation in case that we only run insertion commands without any data modification such as MODIFY and DELETE statement. @To maintainer: ---------------- First, Note that the number of insertion commands results in more synchronization cost in kernel space. For example, the more we call a write(2) syscall, the more Linux kernel calls submit_bio(9) and futex_wait(9) kernel function. Disabling a synchronous operation will cause SQLite3 to not wait on data to reach the disk surface, which will make write operations appear to be much faster. Second, Note that you have to check frequently if the version of SQLite3 is state-of-the-art. As we all know, the existing bugs is often fixed in the latest version of SQLite3. @Evaluation: ---------------- - How to do unit-test: $ cd ./msg-service $ time sqlite3 ./mybenchmark.db < ../msg-service-db.sql - Before this patch: real 0m8.277s user 0m0.038s sys 0m0.074s - After this patch: real 0m0.116s user 0m0.018s sys 0m0.003s @Reference: ---------------- - Pragma statements supported by SQLite, https://www.sqlite.org/pragma.html Change-Id: I85b181b16c54c97eac6216292ae7f288452139f7 Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
-rwxr-xr-xconfig/msg-service-db.sql5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/msg-service-db.sql b/config/msg-service-db.sql
index c62dd84..b4b5627 100755
--- a/config/msg-service-db.sql
+++ b/config/msg-service-db.sql
@@ -1,4 +1,9 @@
PRAGMA user_version=3;
+PRAGMA journal_mode = PERSIST;
+PRAGMA synchronous = OFF;
+PRAGMA locking_mode = EXCLUSIVE;
+PRAGMA temp_store = MEMORY;
+PRAGMA cache_size=-5000;
CREATE TABLE MSG_CONVERSATION_TABLE
(