Skip to content

feat: add collector-aware as2rel output alongside classic aggregate - #13

Merged
digizeph merged 3 commits into
mainfrom
dev/collector-indexers
Jul 23, 2026
Merged

feat: add collector-aware as2rel output alongside classic aggregate#13
digizeph merged 3 commits into
mainfrom
dev/collector-indexers

Conversation

@digizeph

Copy link
Copy Markdown
Member

Summary

Extends as2rel-index to produce per-collector provenance data alongside the existing classic aggregate, from a single pass over daily files.

Changes

  • as2rel-index now produces TWO output files per prefix (as2rel, as2rel-v4, as2rel-v6):

    • Classic: {prefix}-latest.json.bz2 — identical format to v1, no breaking changes
    • Collector: {prefix}-collector-latest.json.bz2 — per-edge collector breakdown with per-collector paths/peers counts
  • Memory-efficient flat vector + sort approach — ~1.7GB peak RSS for 21M records (previous nested-HashMap approach used 30GB+)

  • Removed standalone as2rel-collector-index and pfx2as-collector-index (pfx2as collector deferred)

Output format (collector file)

{"generated_at":"2026-07-23T17:22:12Z","input_files":79,"entries":[
  {"asn1":13335,"asn2":174,"rel":1,
   "total_paths_count":120,"total_peers_count":12,"collector_count":14,
   "collectors":{
     "route-views3":{"project":"route-views","paths_count":42,"peers_count":3},
     "rrc00":{"project":"riperis","paths_count":35,"peers_count":2}
   }
  }
]}

Tested

  • 79 collectors, July 22 data on homebsd (FreeBSD 14.2)
  • Global as2rel-collector: 45.5 MB compressed (6.7× larger than 6.8 MB classic)
  • fmt / clippy / tests all green
  • No CLI interface changes — drop-in compatible with existing cron script

digizeph added 3 commits July 23, 2026 10:00
Add as2rel-collector-index and pfx2as-collector-index binaries that
preserve per-collector provenance in latest-snapshot aggregates.

- as2rel-collector-index: walks daily as2rel_*.bz2 files and produces
  as2rel-collector-latest.json.bz2 with per-edge collector breakdown
- pfx2as-collector-index: same pattern for pfx2as data
- Each output includes generated_at timestamp, input file count,
  total/cross-collector sums, and collector-level detail
- Fix pre-existing clippy warnings in bootstrap.rs (useless borrows
  in format! macros)
The previous implementation used HashMap<(u32,u32,u8), HashMap<String,Detail>>
which created per-edge sub-HashMaps causing 30GB+ memory usage with ~500K edges.

Now uses:
- Flat Vec<(u32,u32,u8,u16,usize,usize)> for as2rel
- Flat Vec<(u32,u32,u16,usize)> for pfx2as (with prefix string interning)
- Sort by key then group with O(1) extra memory
- Manual streaming JSON writer avoids serde_json::to_value() DOM tree
Rewrite as2rel-index to produce BOTH outputs from a single file pass:
1. Classic: {prefix}-latest.json.bz2 (unchanged v1 format — no breaking change)
2. Collector: {prefix}-collector-latest.json.bz2 (new per-collector provenance)

Uses flat vector + sort approach for memory efficiency (~1.7GB peak RSS
for 21M records). All three prefixes (as2rel, as2rel-v4, as2rel-v6) get
both output files.

Remove standalone as2rel-collector-index and pfx2as-collector-index
binaries — collector output is now integrated into as2rel-index.
@digizeph
digizeph merged commit d718bec into main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant