From 65e3624bf8356e3a42297a118814b7e4c6d9783c Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Thu, 8 Oct 2020 19:42:23 +0200 Subject: Optimize SQLite database. * src/cuirass/database.scm (set-db-options): Optimize database parameters. --- src/cuirass/database.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) -- cgit v1.2.3