summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-10-08 19:42:23 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-10-14 14:22:17 +0200
commit65e3624bf8356e3a42297a118814b7e4c6d9783c (patch)
treed5a01f19fdaab9324d754980fe7fce2811a5f00a
parentb67f38a7b91c8605a3ae9eba1e2bd3da4b579622 (diff)
downloadcuirass-65e3624bf8356e3a42297a118814b7e4c6d9783c.tar
cuirass-65e3624bf8356e3a42297a118814b7e4c6d9783c.tar.gz
Optimize SQLite database.
* src/cuirass/database.scm (set-db-options): Optimize database parameters.
-rw-r--r--src/cuirass/database.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 9c5317e..5706a80 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -256,6 +256,17 @@ dedicated to writing. EXP evaluation is queued unless #:force? is set."
;;(sqlite-busy-timeout db (* 30 1000))
(sqlite-exec db "PRAGMA busy_timeout = 30000;")
+ ;; The want to prioritize read operations over write operations as we can
+ ;; have a large number of clients, while the number of write operations is
+ ;; modest. Use a small WAL journal to do that, and try to reduce disk I/O
+ ;; by increasing RAM usage as described here:
+ ;; https://wiki.mozilla.org/Performance/Avoid_SQLite_In_Your_Next_Firefox_Feature
+ (sqlite-exec db "PRAGMA wal_autocheckpoint = 16;")
+ (sqlite-exec db "PRAGMA journal_size_limit = 1536;")
+ (sqlite-exec db "PRAGMA page_size = 32768;")
+ (sqlite-exec db "PRAGMA cache_size = -500000;")
+ (sqlite-exec db "PRAGMA temp_store = MEMORY;")
+ (sqlite-exec db "PRAGMA synchronous = NORMAL;")
db)
(define (db-load db schema)