Follow every change
A search index, a cache or another service should learn what changed in the graph, and never miss a write.
The situation
For a team that keeps something in step with the graph: a search index, a cache, a report. Reading everything again is slow, and a plain counter of changes can skip a write that committed late: with 99 uncommitted and 100 committed, a reader at 100 would never see 99.
Step by step
-
Problem 1. Read it all again
The search index has no way to ask what changed, so it reads the whole graph again, or keeps a counter that can step past a change committed late.
A committed change skipped: possible · Added to a write: — · Changes kept for: —
-
With graphos 2. Recorded in the same transaction
graphos records every write in the same transaction that makes it: a write that fails or rolls back leaves no record.
A record says what changed, not the values: its cursor, the operation, the kind and label, the ids, the revision, and who wrote it.
-
How it works 3. Start from the head
To sync from scratch, the index takes the head (
GET …/changes/head), reads the data, then follows the changes from that head on. -
How it works 4. Read after a cursor
GET …/changes?after=answers up to 1,000 records, the next cursor, and whether there are more.The feed never skips a committed change. It delivers at least once, so a record can arrive twice.
A committed change skipped: never
-
With graphos 5. Or follow it live
GET …/changes/streamsends each change as a Server-Sent Event, resumable withLast-Event-ID, and a keep-alive every 15 seconds. The Python client hasstream_changes(). -
How it works 6. What it costs
Measured on the development setup (PostgreSQL in Docker Desktop, 1.2 ms a round trip): +1.8 ms on a single write, 0–14 % on 500-row bulk batches.
Changes are kept 7 days by default; a cursor older than that is answered 410, so the reader syncs again from the head.
Added to a write: +1.8 ms on a single write · Changes kept for: 7 days, by default
What graphos does here
- Change feed
- Records every write in its own transaction.
- Writes through the API
- Every write path feeds it, bulk loads and reconciles included.
- Python client
- Reads or streams the feed from Python.
What shows it: Measured
Measured, in graphos's concept guide on its development setup: +1.8 ms on a single write and 0–14 % on 500-row bulk batches. Tests check that a late commit is never skipped and the stream, and a soak test ran for over half an hour. The index and the cursors drawn are examples.
In graphos's latest release, with a result measured in graphos's own docs; each says on what.
Try it
The usage guide's change-feed section shows the cursor, the stream and syncing from scratch.
Related use cases
- Load a big graph, and load it again · Tens of thousands of edges should go in fast, and sending them again after a failure should be safe.
- Keep the edges equal to the source · The graph should match the source system's current edges, without a gap while it catches up.
- One graph, many services · Several services need the same connected data, and none of them should hold the database.