-
Notifications
You must be signed in to change notification settings - Fork 39
Caches and performance tuning
mvSQLite keeps a client-side page cache that is always consistent with persisted data. Cache invalidation is differential: on transaction boundaries, only remotely changed pages are invalidated.
When the size of the page cache is set to a large enough value, it essentially converges into an in-memory consistent snapshot of the database. At this point, the minimum network overhead of a read-only transaction is just a get-read-version request at the beginning.
Apps have different data access patterns: some apps usually do point gets and sets, while others like to do full-table scans. Also, under some deployments the latency between mvstore
and clients can be high (although this is not recommended). The default runtime parameters are optimized for point-gets/small range scans and low-latency networks.
If:
- your application likes to scan large ranges
- you are running something like
VACUUM
orPRAGMA integrity_check
- the latency between
mvstore
and the client is greater than 5ms
follow the advice below:
- Set
MVSQLITE_PAGE_CACHE_SIZE
to a larger value (the unit is number of pages & the default page size is 8192 bytes). - Set
MVSQLITE_PREFETCH_DEPTH
to a larger value. Recommended: 100.