Two brains
Ignitify · two peers, one database, no leader
brain 1 stopped
brain 1 out · 3 failed checks
brain 1 back · 2 good checks
Tenanta request
fleet host
VM
Host agent
Load balancerin front of both brains
check: every 5 s
3 failed: out
2 good: back
Brain 1a peer
Brain 2a peer
Brain 1stopped
no leader
✓ 1 row · wins the run
0 rows · changes nothing
started the run
✓ settles the run
starts again
✓ carries on
PostgreSQL
The system of recordboth brains use it
run 019a3f6e…PENDING
run 019a3f6e…PROVISIONING
the claimUPDATE … WHERE status = 'PENDING'
queue jobclaimed by brain 1
queue jobclaimed by brain 2
tenant quotachecked under a lock
host capacitychecked under a lock
run 019a3f6e…RUNNING
run 019a3f6e…COMPLETED
the VM · idle poolidle_since is set
run 019a41b2…RUNNING
run 019a41b2…COMPLETED
run 019a41c7…PROVISIONING
run 019a41c7…PENDING
queue jobclaimed by brain 1
queue job · after 120 sback in the queue
mTLS
✕ out
Two brains run behind one load balancer.
The two brains are peers. There is no leader.
Both brains use one PostgreSQL database. It is the system of record.
The load balancer sends tenant requests to the two brains in turn, request by request.
The host agent calls the load balancer too, over mTLS. Any brain may answer.
Both brains run every background loop. A guarded write to the database makes that safe.
Both brains can list the same PENDING run.
The claim is an update that needs the status PENDING. One brain wins the run. The other changes nothing.
A brain claims queue jobs with SKIP LOCKED. Two brains get different jobs.
The quota of a tenant and the capacity of a host are checked under a lock.
Brain 1 started this run. Its VM is on a fleet host.
The result goes from the guest to the host agent, then to the load balancer. This time, brain 2 answers.
Brain 2 settles the run. The write needs the status RUNNING, so the first end result wins.
A VM that can be reused goes to the idle pool, in the database. No row names the brain that started a VM.
Brain 1 shuts down. It writes nothing to the runs. The VMs are on the fleet hosts, and they outlive every brain.
The load balancer checks each brain every 5 seconds. Three failed checks take brain 1 out.
Brain 2 carries on. Any brain settles a run.
Brain 1 starts again. It puts each PROVISIONING run back to PENDING. It does not touch a RUNNING run.
Two good checks bring brain 1 back. The default limit is 3: the third brain crash makes a run FAILED.
A job that stays claimed for more than 120 seconds (the default) goes back to the queue.
Two brains. One database.
No leader. One winner for each run.
Ignitify · Firecracker MicroVMs