Server-run engine: a restored network plays on exactly as before
A network loaded from its checkpoint drifted from the one that never stopped:
after a checkpoint on day 1, 2 or 5 its R differed at once (bizDem at Ashburn
6426 against 26, then cityDem, citySrv, tNet), and from the next day S too
(cash, eyeball growth). Three causes, each shown by a probe:
- R after a day is the R of the day's last routing, made before the day's end
changed S (customers who left or signed, moods, bills, transit history) and
routed from the memory of the R before it. srvLoad routed the saved S again
from R's own memory: another R, which the next day reads (sfOf for eyeball
growth, the peering share). Every compute() in the realm now keeps, for the
R it makes, S as it routed it (one JSON per top-level key, 0.8 ms big) and
the memory it started from. rt carries that routing point (pt: the memory,
the keys that changed since, the keys S did not have then), and srvLoad
routes that S again from it: the same R, byte for byte. The old restore test
checkpointed after day 10, where a failure or event routed again at the end
of the day and nothing changed after it: it passed by luck.
- The sales desk's tried offers (UI.slTried, an offer that did not fit waits a
week) live outside S. A fresh realm forgot them and the desk tried other
offers. rt carries them (sl); a day mark keeps them and the in-place restore
after a throw puts them back (before, a parsed S dropped them).
- A save and a reload give some keys back in another key order (a customer's
defaults go last, the intern's week tally in its own order), and the week's
report lists the tally in that order. At a checkpoint rt carries the live
text of each such key (ord, srvGate's round trip, about 8 ms), taken on load
only where it holds what sanitize() made of the save. A fresh realm after a
timeout takes the mark's own text the same way (live).
The plain game drifts across a save and a reload too (jsdom: from the first
day after it; the page routes a reloaded S with an empty R and keeps no desk
memory): a game property, so the engine carries what is missing.
The envelope keeps its shape {s, uidN, rt, last, day}; rt keeps R's own route
memory, so an older checkpoint loads as before (close, not exact). Big network:
the checkpoint grows from about 42-49 KB gzip to 54-79 KB (rt 7-29 KB; the
whole R would be 375 KB), srvSave from 2-2.5 ms to 7-8 ms, a load by one
routing. A day with its mark costs the same (big 39.8 -> 37.8 ms, busy
90.0 -> 88.8 ms, within noise: the day mark joins per-key JSON now, which pays
for the routing point).
Tests: the restore test checkpoints after days 1, 2, 5 and 10 of the scenic big
network and of the same network busy (intern on every order, the desk signing
on its own, failures, events, an attack), those after days 2 and 10 right after
an action and a what-if (sent to the copies too), each compared byte for byte
at once and 10 days later (SIM_LONG: after every day to 30, 60 checkpoints). It
fails on the old engine, and without any one of the three parts. The retry test
plays busy networks (fails without the desk memory in srvRestore). The market
checkpoint compares bytes too; canon() is gone.
This commit is contained in:
parent
065c922287
commit
c5c7ea9508
5 changed files with 169 additions and 72 deletions
|
|
@ -6,8 +6,10 @@
|
|||
// const engine = createEngine({workers: 2, heapMb: 1536, root, log});
|
||||
// engine.load(code, [{nid, env?, begin?, lang, prefs, rng?}]) → [{t:'loaded', nid, epoch, day, lost, saved?} |
|
||||
// {t:'loaded', nid, err}], one per network, in order. env: the checkpoint envelope {s, uidN, rt, last,
|
||||
// day} (s: the save text); begin: {name, home, preset, asn, mp, tut} builds a new network, checkpointed
|
||||
// at once (saved). A network whose save does not load (or that cannot begin) answers err: broken (4.7).
|
||||
// day} (s: the save text; rt: what the realm needs besides it to play on exactly as before, opaque
|
||||
// here: route memory, R's routing point, key order, the sales desk's memory); begin: {name, home,
|
||||
// preset, asn, mp, tut} builds a new network, checkpointed at once (saved). A network whose save
|
||||
// does not load (or that cannot begin) answers err: broken (4.7).
|
||||
// engine.day(code, {d, speed, last, alone:[nid], nets:[nid], mute}) → {t:'dayDone', code, d, nets:{[nid]: {day, lost,
|
||||
// pause?, err?, retried?, ms}}}. Each network in sorted order; one that failed twice answers err and
|
||||
// its day as it was, and is broken from then on (no more days; actions answer 'stopped').
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue