Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 2.36 KB

File metadata and controls

85 lines (64 loc) · 2.36 KB

Implementation Plan Update Summary

Changes Made

Updated the BBolt registry backend implementation plan to include Phase 3: Incremental GC Optimization.

Three-Phase Approach

Phase 1: BBolt Backend (5-9 days)

  • Basic bbolt backend with full-scan GC
  • Suitable for registries < 100K entries
  • GC time: ~1-2 seconds for 100K entries, ~7-13 seconds for 1M entries

Phase 2: In-Memory Cache (4-5 days)

  • Two-layer caching system
  • Full-scan GC for both cache and disk
  • Performance improvement for hot data

Phase 3: Incremental GC (4-5 days)

  • Batch-based incremental scanning
  • Cursor tracking across GC cycles
  • Adaptive strategy (auto-selects based on registry size)
  • Performance: ~0.5 seconds per 50K batch (vs 7-13s for 1M full scan)
  • Scalable to 10M+ entries

New Configuration Parameters

filebeat.registry:
  type: bbolt
  bbolt:
    disk_ttl: 30d
    cache_ttl: 1h
    gc_batch_size: 50000  # NEW: Entries per GC cycle

New Files Added (Phase 3)

  • gc_incremental.go - Incremental GC implementation
  • gc_adaptive.go - Adaptive GC strategy selector

Key Additions

  1. Incremental GC Algorithm

    • Cursor-based scanning
    • Configurable batch size (default: 50K)
    • Wrap-around logic when reaching end
    • Full cycle tracking and logging
  2. Adaptive Strategy

    • Auto-selects GC method based on registry size
    • < 100K entries: full scan (simpler, fast enough)
    • > 100K entries: incremental scan (scalable)
  3. Performance Metrics

    • GC duration logging
    • Entries scanned/deleted tracking
    • Full cycle completion reporting
  4. Cache Incremental GC

    • Snapshot-based scanning for in-memory cache
    • Batch processing of cache entries
    • Position tracking

Timeline Impact

  • Previous total: 9-14 days
  • New total: 13-19 days
  • Phase 3 is optional - can be deferred if registries remain small

Decision Rationale

Phase 3 addresses scalability concerns for large registries (1M+ entries) while keeping Phase 1 & 2 simple. The incremental GC:

  • Reduces GC pause time from 7-13s to ~0.5s per batch
  • Enables horizontal scalability
  • Provides smooth, predictable performance
  • Can be enabled/disabled via configuration

Documentation Updates

  • GC performance analysis section added
  • Configuration examples updated
  • Sizing guidelines documented
  • Success criteria expanded
  • Timeline adjusted