Write the routing table every second and read it at startup (part of #122)
check / check (push) Waiting to run
check / check (push) Waiting to run
The prefix handler applies each update to the routing table in memory as it handles it, sorted into announcements and withdrawals as for the live route tables. Each flush first writes at most 20,000 of the table's changed pairs, with every new peer; the rest follow in the next flushes. A failed write puts its changes and new peers back in the table. Stop makes one last flush, and logs the changed pairs left. Startup reads the table before the streamer connects, and logs its pairs, peers and time. The per-peer counts are a slice, so the read takes about a third less time. The health check's start period is 60 seconds, so a full table's read fits before upaas looks. Model: opus-5-5
This commit is contained in:
@@ -285,6 +285,8 @@ routewatch/
|
||||
|
||||
2. **Initialization** (`internal/routewatch/app.go`)
|
||||
- Database created with SQLite schema (WAL mode, page caches as in "Memory")
|
||||
- The routing table read from the database into memory, before the streamer
|
||||
connects
|
||||
- Message handlers registered with the streamer
|
||||
- HTTP server started on configured port
|
||||
|
||||
@@ -311,7 +313,10 @@ routewatch/
|
||||
holds AS 0 anywhere, deletes all of a peer's routes when its BGP session
|
||||
goes down). Routes are kept per peer IP, so when one peer IP has sessions
|
||||
on two collectors, a session going down on one also removes the routes the
|
||||
other still carries, until they are announced again.
|
||||
other still carries, until they are announced again. It also applies each
|
||||
update to the routing table in memory, and writes the table's changes to
|
||||
the database every second. A write takes at most 20,000 changed prefix and
|
||||
origin AS pairs, and the rest follow in the next writes.
|
||||
- **PeeringHandler**: Extracts AS peering relationships from AS paths
|
||||
|
||||
5. **HTTP Request Flow**
|
||||
@@ -495,7 +500,9 @@ What the [upaas](https://git.eeqj.de/sneak/upaas) app needs:
|
||||
- Health check: the image's `HEALTHCHECK` requests
|
||||
`/.well-known/healthcheck.json` on the container port. upaas reads the
|
||||
container's health 60 seconds after a deploy and fails the deploy unless it is
|
||||
`healthy`.
|
||||
`healthy`. For the first 60 seconds, Docker 25 and later runs the check every
|
||||
5 seconds, and the first pass makes the container healthy. Startup first reads
|
||||
the routing table, which takes about 25 seconds when the table is full.
|
||||
- Stop grace: the container needs 9 seconds between SIGTERM and SIGKILL. upaas
|
||||
gives 10 (`stopTimeoutSeconds` in its `internal/docker/client.go`), as
|
||||
`docker stop` does by default. The daemon allows 8 seconds for the handlers to
|
||||
|
||||
Reference in New Issue
Block a user