Edge & Failover¶
You can run a Dory processor at the edge — on your own hardware, close to where the data is produced (a camera, a sensor, a machine on a factory floor). Edge machines lose power, drop off the network, and get replaced. The platform keeps your processor available through all of that, and it does so without you writing any failover logic.
The short version: your processor sends regular heartbeats to the platform. If its edge machine goes silent, the platform fails the processor over — typically to the cloud — and brings its saved state along, so it picks up where it left off. When the edge machine comes back, the platform fails it back home. Throughout, fencing guarantees that only one copy is ever the active writer, so a failover never produces duplicate or conflicting output.
Heartbeats: staying visible to the platform¶
A processor running at the edge periodically reports that it is alive and healthy. The platform uses these heartbeats to decide whether the edge instance is still doing its job. Miss enough of them in a row and the platform treats the instance as down and starts a failover.
This is automatic. When your processor is deployed to run at the edge, the SDK sends the heartbeats for you and reports basic health (connected, degraded, or disconnected). You don't configure endpoints or intervals in your processor code.
Failover: moving the work with its state¶
When the platform decides an edge instance is gone, it starts a standby copy — usually in the cloud — and promotes it to take over. That replacement restores the processor's last saved state, so it resumes from the same point rather than starting cold. See State Management for how state is captured and restored.
From your code's perspective, nothing special happens: the same processor logic runs in the new location, against the same state, emitting to the same event stream.
Failback: returning home when the edge recovers¶
When the edge machine comes back online and is healthy again, the platform can move the processor back to its edge home and retire the cloud stand-in — once again with state carried across, so there is no gap and no reset.
Fencing: only one active writer, ever¶
The tricky part of any failover is the moment in between, when an edge instance is thought to be dead but is actually just slow or briefly partitioned. For a heartbeat or two, two copies of the same logical processor can be running at once. If both kept writing output, you'd get duplicates — or worse, two instances disagreeing about the truth.
Dory prevents this with fencing. At any moment, exactly one instance holds the right to be the active writer. When the platform promotes a new instance, the old one is automatically fenced off: even if it is still running, it can no longer publish results or write state. There is no window in which two instances are both authoritative.
You get this protection for free. The active instance processes and publishes normally; a fenced instance simply stops producing output. You don't manage the fence, and you don't have to write idempotency or de-duplication logic to survive a failover.
How it fits together¶
flowchart TB
subgraph EDGE[Edge machine]
EP[Processor instance]
end
subgraph CLOUD[Cloud]
SB[Standby instance]
end
PLAT[Dory platform]
STATE[(Saved state)]
OUT[Event stream]
EP -- heartbeats --> PLAT
EP -- state saved --> STATE
EP -- "active writer (fenced as single)" --> OUT
PLAT -. "heartbeats stop -> failover" .-> SB
STATE -. "state restored" .-> SB
SB -- "promoted: now the single active writer" --> OUT
SB -. "edge recovers -> failback (state restored)" .-> EP
Heartbeats flow from the edge instance to the platform. When they stop, the platform promotes the standby copy in the cloud and restores the processor's state into it; fencing ensures the promoted copy is the only active writer. When the edge machine recovers, the platform fails the processor back home — again with its state — and retires the cloud stand-in.
What you do vs. what the platform does¶
| Concern | Who handles it |
|---|---|
| Sending heartbeats / reporting health | Platform (via the SDK) |
| Detecting a dead edge machine | Platform |
| Starting and promoting a replacement | Platform |
| Carrying state across the move | Platform (you just use state) |
| Ensuring a single active writer (fencing) | Platform |
| Failing back when the edge recovers | Platform |
| Your processing logic | You |
The takeaway: write your processor once, the way you would for a single instance. Save the state that matters with the state APIs, publish results with the output APIs, and the platform keeps it available across edge failures without any failover code on your side.