docs: tile gate is dbLock-free, private mutex (#65)
This commit is contained in:
+1
-1
@@ -367,7 +367,7 @@ simpler than any outbox with byte accounting and fits the pin's limits.
|
||||
| Polygon, dense 5k | 1.28 ms | ~0.1 ms (sweep) |
|
||||
| Thick, dense, 6-token party | 75.6 ms | a few ms (sweep, near faces) |
|
||||
| Vision frame per move | 3.4-3.7 KB | ~1 KB (quantised) |
|
||||
| Tile request cost | global lock + DB + SHA-256 | lock-free map lookup + bit test |
|
||||
| Tile request cost | global lock + DB + SHA-256 | `dbLock`-free map lookup + bit test (private mutex) |
|
||||
| Data-race class | present | gone |
|
||||
|
||||
---
|
||||
|
||||
+9
-4
@@ -469,10 +469,15 @@ server clamps nothing silently (clamping would leak the hit distance, T8).
|
||||
whole explored `HashSet` per player (~4.9 ms at 262144 cells on the review build, measured).
|
||||
Nothing that egress holds may outlive the lock hold.
|
||||
- **The scene is a value swapped, never mutated, under the lock** (#31): every reader takes one
|
||||
snapshot under `dbLock` and uses it for the whole request — `tileGate` (parse, explored check and
|
||||
`X-Accel-Redirect` from one record), `checkScene` (the id), the wall/door handlers (the post-lock
|
||||
log and effect frame). A handler that reads `app.scene` twice can see two records; one that reads
|
||||
it outside the lock races the assignment and ORC's free of the old `walls`.
|
||||
snapshot under `dbLock` and uses it for the whole request — `checkScene` (the id), the wall/door
|
||||
handlers (the post-lock log and effect frame). A handler that reads `app.scene` twice can see two
|
||||
records; one that reads it outside the lock races the assignment and ORC's free of the old
|
||||
`walls`.
|
||||
- **The tile gate is `dbLock`-free** (#65): `tileGate` reads the `GateCache` under its own private
|
||||
mutex (not lock-free, just off the global lock) — a hash lookup and a bit test, no SQL, no
|
||||
`app.scene` snapshot. Writers (join, key replacement, player removal, explored refresh) update
|
||||
the cache under `dbLock` before the ack, so a revoked session or a freshly explored cell is
|
||||
visible before the client's next request.
|
||||
- SQLite tail: server worst ~20 ms is the COMMIT and every other mutation queues behind it as
|
||||
`lock_wait` (measurement and hypothesis: TESTING §4.3). Accepted for v1. Moving persist out of the
|
||||
lock breaks ack-after-commit and order; not done.
|
||||
|
||||
Reference in New Issue
Block a user