Closed domob1812 closed 4 years ago
As one step, this switches the SQLite databases to WAL mode, so that we can take efficient read-only snapshots as needed. This seems to have no major impact on performance, neither with Taurion nor SME (as examples): wal-vs-nowal.zip
As an example: Calling getregions(fromheight=0)
on Taurion 0.2 without this patch blocks the daemon for around 500ms on my system (e.g. when immediately following up with a call like getnullstate
). With this change, the second call returns in around 10ms, which is the same as if getregions
would not have been called at all.
This implements #95: Where possible, we uncouple the "game-state extraction" logic in
GetCustomStateData
from the main lock onGame
. In particular forSQLiteGame
-based GSPs, this can be done with read-only database snapshots, and allows us e.g. to run expensive operations (like all regions in Taurion) without further blocking other operations.Note that the full-game-state method
GetCurrentJsonState
(getcurrentstate
RPC method) does not benefit from this currently. It doesn't matter much, though, as this method is not meant for performance-critical things anyway (only for testing / debugging).