Make live route writes cheaper so the prefix handler keeps up (closes #96)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The live route tables lose their random UUID key; the row id the prefix-length sample draws is declared as the integer key. The prefix tables are keyed by prefix and keep only first_seen; a batch inserts only prefixes not stored yet. A route update sets only the columns that change. Each kept index names the queries using it. Every write goes through one connection kept for writing, with a 1 GiB page cache; reading connections get 16 MiB, heap limits rise to 1.5 and 2 GiB (README "Memory"). Batch writes go in key order. A benchmark run by hand writes 250,000 updates on 5 million routes faster than the feed's 10,000 a second; a live run follows. Model: opus-5-5
This commit was merged in pull request #98.
This commit is contained in:
@@ -35,13 +35,11 @@ type ASN struct {
|
||||
}
|
||||
|
||||
// Prefix represents an IP prefix (CIDR block) with its IP version (4 or 6)
|
||||
// and first/last seen timestamps.
|
||||
// and the time it was first seen.
|
||||
type Prefix struct {
|
||||
ID uuid.UUID
|
||||
Prefix string
|
||||
IPVersion int // 4 or 6
|
||||
FirstSeen time.Time
|
||||
LastSeen time.Time
|
||||
}
|
||||
|
||||
// Announcement represents a BGP announcement or withdrawal event,
|
||||
@@ -71,7 +69,6 @@ type ASNPeering struct {
|
||||
//
|
||||
//nolint:tagliatelle // field names are the existing JSON API
|
||||
type LiveRoute struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Prefix string `json:"prefix"`
|
||||
MaskLength int `json:"mask_length"`
|
||||
IPVersion int `json:"ip_version"`
|
||||
|
||||
Reference in New Issue
Block a user