Repository navigation
Upgrade notes
batch_timeout_ms now takes effect. Before, the writer ignored it and committed whatever was queued as soon as it was free. Now, after a batch's first write, it waits up to batch_timeout_ms for more, until the batch is full. If your config sets batch_timeout_ms > 0:
- Async writes stay uncommitted for up to that much longer, so a crash loses more acknowledged writes.
- Sync writes reply up to that much later. A client sending sync writes one at a time gets at most one per
batch_timeout_ms.
Set batch_timeout_ms = 0 (the default) to keep the old behaviour. A timeout mainly pays off with synchronous = "FULL", where every commit fsyncs. With the default NORMAL, commits are cheap and a timeout rarely helps.
New optional config: write_queue_capacity (default 1024). It sets how many writes each shard can queue before writes to that shard, async ones included, wait for room. The queue used to hold batch_size writes (100 when unset), so if you set batch_size, your queue is now larger. Size it to your memory: each queued write holds its value until it's committed.
One more SQLite connection per shard. HSET, HDEL and DEL now check whether a key exists on a dedicated connection. The sqlite.cache_size_mb and sqlite.mmap_size budgets are now split across one more connection per shard. It appears as pool="check" in blobasaur_sqlite_pool_connections.
Fixes
- Async HSET, HDEL and DEL were slow: with
async_write = true, they waited for the writer's commit in progress before replying, because their existence check ran on the writer's only connection. They now reply as soon as the write is queued, like async SET. (#21) - Lost async writes: if another connection, such as a
sqlite3session, held a shard's write lock, the writer's writes failed immediately instead of waitingbusy_timeout. Async writes that had already been acknowledged were lost. The writer now takes the write lock when the batch starts, so it waits like any other writer. A lock held longer thanbusy_timeoutstill fails the batch. (#22) batch_timeout_msdid nothing, andbatch_sizealso capped the write queue. See the upgrade notes. (#23)
Commits
e4a22ca: Merge pull request #23 from iamd3vil/fix/batch-timeout-and-queue-capacity (@iamd3vil)
996412e: fix(shard)!: make batch_timeout_ms wait, and size the write queue on its own (@iamd3vil)
9aed010: Merge pull request #22 from iamd3vil/fix/writer-begin-immediate (@iamd3vil)
cedecc3: fix(shard): start writer transactions with BEGIN IMMEDIATE (@iamd3vil)
c52633b: Merge pull request #21 from iamd3vil/fix/async-hset-existence-check (@iamd3vil)
2145107: fix(server): stop async HSET, HDEL and DEL waiting on the writer (@iamd3vil)