AltSql Mesh ยท Live demo
Twelve devices, one table, no signal
A sheep farm with no mobile coverage and no gateway. Three utes, four quad bikes and five people on foot carry a device each. They read the water troughs, open and close gates, add jobs and clear them, and count sheep, all into one shared table. Whenever two come within radio range they sync, over a link that loses messages. Stop the writing and watch every device end up with the same table.
Simulated farm, real engines. The farm, the people and the radio are simulated. Twelve copies of AltSql Core and AltSql Mesh run in this page, compiled to WebAssembly, one per device.
Try this
Loading the engine
The farm
0:00How far behind
Not startedFor every key, the newest version on any device; the line counts, over all twelve devices, the keys a device holds an older version of, or lacks.
What it took
The devices
Click one, on the farm or here, to ask it.
Device 0: what it has seen of each device's changes
Each bar is one device of the fleet: how many of its changes this device has recorded, against how many there are.
Ask a device
Every device can run SQL on the table it holds: field (time, key, level, state, note, dev, clock), one row per key, with dev and clock saying which device's version it holds; and field_counts (time, name, dev, part), each device's share of each counter.
Try to break it
Devices lose half their messages, lose power, drift out of reach of each other, or disappear for an hour. Every device must still end with the same table, and the bookkeeping must stay inside its budget.
What is real here
Real
- AltSql Mesh: the merging, the version vectors, the tombstones and their clean-up, the messages and their checks, and the SQL on each device.
- AltSql Core: each device's own database, on its own flash, twelve of them.
- The power cuts are cuts in the middle of real writes, and the lost and damaged messages are real messages.
Simulated
- The farm, the people and their routes, the troughs draining, from a fixed recipe, so the numbers are the same every time.
- Time: a second of farm time is a step, and the page runs many steps a second.
- The radio: range and loss are settings, and a message goes across in no time. Each device's flash, 192 KB, is emulated in memory the way the engine sees real NOR flash.