Files
krust/docs/performance.md
T
Erfan Yousefi ffa8a7cb50 feat: establish krust v0.1 foundation with k9s-compatible UX and OSS release scaffolding
This commit consolidates the first production-ready baseline for krust, including core runtime behavior, operator UX, safety rails, and project publication assets.\n\nCore runtime and architecture\n- Implement lazy, active-scope watch-plan reconciliation across contexts/kinds/namespaces\n- Keep warm-context retention bounded by TTL for faster context switching\n- Add bounded watch reconnect handling and terminal handling for RBAC-forbidden watchers\n- Keep invalidation-driven rendering with FPS control and bounded log/state paths\n\nOperator UX and workflows\n- Expand k9s-style navigation/command aliases for supported Kubernetes resources\n- Improve pane consistency for table/detail/log overlays and scrolling behavior\n- Add detail viewer search semantics (non-destructive search/highlight) with match navigation\n- Add YAML/JSON detail format toggle and syntax highlighting for both formats\n- Add secret decode pane improvements and format-aware edit/apply behavior\n- Add clipboard copy and dump flows with native backend + OSC52 fallback\n\nSafety and action model\n- Keep readonly enforcement for mutation paths\n- Maintain guarded action behavior and clearer error/status surfacing\n\nDocumentation and open-source readiness\n- Rewrite README for community-facing onboarding and operational clarity\n- Add architecture and performance guides under docs/\n- Add CONTRIBUTING guide and PR template\n- Add GitHub Actions CI pipeline (fmt/check/test/release build)\n- Add GitHub Actions release pipeline for tagged multi-platform artifacts\n- Add Cargo package metadata and repository links\n- Add .gitignore hygiene for macOS Finder artifacts\n\nQuality and verification\n- Bring strict clippy (-D warnings) to clean state for current codebase\n- Validate full required pipeline: fmt, check, test, and release build
2026-03-08 03:29:19 +01:00

2.6 KiB

krust Performance Guide

This document explains how krust keeps latency predictable and how to reason about performance-sensitive changes.

Performance Priorities

In order:

  1. Input responsiveness
  2. Controlled API pressure
  3. Bounded memory behavior
  4. Visual stability (no redraw thrash)

krust intentionally does not optimize for maximum background data breadth by default.

Core Performance Mechanisms

Lazy activation by default

  • clients are initialized lazily per context
  • watchers are activated from the current watch plan
  • inactive contexts are not fully watched unless retained via warm-context policy

This avoids contexts x resources x namespaces startup explosion.

Watch lifecycle controls

  • dynamic watch-plan reconciliation (replace_watch_plan)
  • bounded exponential reconnect backoff
  • terminal handling for RBAC 403 watcher failures

Result: fewer reconnect storms and less API/server noise.

Projection and render controls

  • state cache revision tracking
  • cached projection reuse when request + revision unchanged
  • invalidation-based render loop with FPS cap

Result: no unconditional full redraw at fixed ticks.

Log-path controls

  • bounded line/byte buffer
  • bounded per-cycle drain
  • per-source filtering without restarting all streams
  • tail/pause behavior to reduce churn during operator inspection

Result: stable log UX under high stream volume.

Configuration Knobs

~/.config/krust/config.toml

[runtime]
fps_limit = 60
delta_channel_capacity = 2048
warm_contexts = 1
warm_context_ttl_secs = 20

Tuning suggestions:

  • many contexts: keep warm_contexts low (0-2)
  • bursty clusters: raise delta_channel_capacity carefully
  • low-power terminals: reduce fps_limit (for example 30)

Operational Recommendations

  • default startup: use lazy mode (krust)
  • only use --all-contexts when eager auth/client warmup is explicitly desired
  • scope namespace when debugging dense clusters
  • in logs, pause or source-filter when hunting specific signals

Benchmark and Validation Hooks

krust includes perf-focused test hooks (some ignored by default) and should always pass full validation:

cargo fmt --all
cargo check
cargo test
cargo build --release

You can run ignored perf tests explicitly when profiling local changes:

cargo test -- --ignored --nocapture

Change Review Checklist (Perf-Sensitive PRs)

When changing watches, rendering, projection, or logs, include:

  • hot path changed
  • expected complexity/cost change
  • API pressure impact
  • memory impact and bounds
  • potential regressions and how to observe them

This keeps performance discussion concrete and reviewable.