You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set WAL journal mode and synchronous=NORMAL: ~4x on the write path #3
SqliteStore opens the database without setting any journal or synchronous pragma, so it runs on SQLite's defaults: journal_mode=DELETE and synchronous=FULL. Every write does a rollback-journal round trip and a full fsync.
Measured per put():
default (DELETE + FULL) 0.078 ms
WAL + synchronous=NORMAL 0.019 ms
Roughly 4x, and it lands on the publish hot path — storeRetained, outgoingEnqueue and incomingStorePacket all go through put(), so it is paid per message rather than per connection.
WAL also lets readers run concurrently with a writer, which suits a broker workload where retained/outgoing scans overlap publishes.
synchronous=NORMAL under WAL is the usual pairing and is durable across process crashes, trading only the last transactions on an OS crash or power loss. That is a judgement call for a broker persisting in-flight QoS state, so it is worth deciding deliberately rather than inheriting the default — and worth exposing as a constructor option if the safer setting is wanted by default.
Note WAL does not work on a database on a network filesystem, and it creates -wal/-shm sidecar files, so anything that copies or backs up the store file needs to know.
Found while reviewing #1 and left out of it: repo-wide performance configuration, unrelated to that PR's security fix.
Activity