This directory is the canonical workspace for Hydra Logger benchmark execution, artifact persistence, drift analysis, and operator review.
- Provide reproducible, profile-based benchmark runs.
- Persist metadata-rich artifacts for audit and comparison.
- Keep benchmark outputs isolated from runtime application logs.
performance_benchmark.py: benchmark entrypoint and suite orchestrator.profiles/: tiered benchmark profile definitions (ci_smoke,pr_gate,nightly_truth).policies/drift_policy.json: canonical drift thresholds and profile overrides.schema/result_schema.json: benchmark artifact schema.results/: persisted benchmark artifacts (timestamped JSON, latest copy, optional reports).baselines/: accepted baseline snapshots and baseline governance notes.bench_logs/: transient logs emitted during benchmark execution.
- Python 3.11+ (project standard).
- Activated project virtual environment.
- Dependencies installed for the workspace.
- Optional:
psutilfor memory benchmark detail (memory section is skipped when unavailable).
Example setup:
source /home/razvansavin/Projects/hydra-logger/.hydra_env/bin/activate
python3 --versionRun benchmark profiles from repository root:
# Fast local smoke signal
python3 benchmark/performance_benchmark.py --profile ci_smoke
# PR-grade benchmark signal
python3 benchmark/performance_benchmark.py --profile pr_gate
# Full nightly-style regression run (heavy workload)
python3 benchmark/performance_benchmark.py --profile nightly_truthExpected behavior:
nightly_truthcan appear idle between prints because workloads are large.- Progress is still active while long sections execute.
- Artifacts are written near run completion (after guard checks and reporting).
benchmark/performance_benchmark.py supports:
--profile <name>: load profile frombenchmark/profiles/.- Valid names currently include
ci_smoke,pr_gate,nightly_truth.
- Valid names currently include
--results-dir <path>: custom artifact root (default isbenchmark/results).--no-save-results: run benchmark without persisting artifacts.--sections <csv>: run only selected benchmark sections (comma-separated).- Valid section names:
sync_logger,network_destination,async_logger,composite_logger,composite_async_logger,configurations,output_matrix,file_writing,async_file_writing,memory,concurrent,async_concurrent,parallel_workers,advanced_concurrent,ultra_high_performance. - Precedence is
--sections(CLI) over profileenabled_sections. - Partial section runs automatically disable result persistence unless you already
set
--no-save-results, preserving full-suite artifact contract expectations.
- Valid section names:
Examples:
# Default profile behavior (legacy default config)
python3 benchmark/performance_benchmark.py
# Save to a profile-specific location
python3 benchmark/performance_benchmark.py --profile pr_gate --results-dir benchmark/results/pr_gate
# Run without artifact persistence
python3 benchmark/performance_benchmark.py --profile ci_smoke --no-save-results
# Run only a local diagnostic slice
python3 benchmark/performance_benchmark.py --profile pr_gate --sections sync_logger,memoryReport verbosity environment variable:
HYDRA_BENCHMARK_VERBOSE_REPORTS=trueenables always-on drift/invariant/leak markdown report output.
ci_smoke:- fastest confidence signal
- drift disabled
write_markdown_reports=false(default JSON-only output)- suitable for quick local verification and CI push checks
pr_gate:- pull request performance signal
- drift enabled with moderate thresholds
write_markdown_reports=false(default JSON-only output)- reliability guards are advisory (reported, not hard-fail)
nightly_truth:- deep regression profile
- drift enabled with stricter thresholds
write_markdown_reports=true(JSON + markdown operator reports)- reliability guard violations hard-fail the run (
strict_reliability_guards=true)
These are practical planning estimates for a typical developer machine (for example
WSL2 laptop/desktop class hardware). Actual time varies with CPU, disk speed,
machine load, and whether --results-dir points to slower storage.
ci_smoke: ~3 to 8 minutespr_gate: ~15 to 35 minutesnightly_truth: ~60 to 150 minutes
Notes:
nightly_truthcan have long quiet periods between log lines because sections are large.- Runtime scales significantly with profile message counts and repetition settings.
- The async suite includes two measured paths (
task_fanoutandlogger_core), which increases wall-clock time.
If you want machine-specific estimates, run once with shell timing and keep the result in your team runbook:
time python3 benchmark/performance_benchmark.py --profile ci_smoke
time python3 benchmark/performance_benchmark.py --profile pr_gate
time python3 benchmark/performance_benchmark.py --profile nightly_truthCore formulas:
messages_per_second = total_messages / durationbytes_per_second = bytes_written / duration
Duration notes:
- Warm-up time is excluded from measured throughput windows.
- Some suites include separate flush/finalization durations as additional fields.
- Printed durations are rounded for console readability; calculations use full precision.
Async logger throughput includes two distinct paths:
task_fanout_*: measured fromlogger.log(...).logger_core_*: measured fromlogger.log_async(...).
Do not merge these into one number; they represent different execution paths.
When save_results is enabled (default):
- A timestamped JSON artifact is written:
benchmark/results/benchmark_YYYY-MM-DD_HH-MM-SS.json
- A convenience latest copy is updated:
benchmark/results/benchmark_latest.json
- Optional markdown report artifacts may be written:
benchmark_latest_summary.mdbenchmark_latest_drift.mdbenchmark_latest_invariants.mdbenchmark_latest_leaks.md
Important:
benchmark_latest.jsonis a convenience pointer copy, not historical storage.- Drift history uses timestamped
benchmark_*.jsonfiles for the same profile. - If a run fails before save, new artifacts are not persisted.
For enterprise comparability, isolate results by profile and run batch:
python3 benchmark/performance_benchmark.py --profile ci_smoke --results-dir benchmark/results/ci_smoke
python3 benchmark/performance_benchmark.py --profile pr_gate --results-dir benchmark/results/pr_gate
python3 benchmark/performance_benchmark.py --profile nightly_truth --results-dir benchmark/results/nightly_truth/2026-03-17Comparison rules:
- Compare same profile only (
ci_smokevsci_smoke, not cross-profile). - Validate metadata compatibility before analysis:
profilepython_versionplatformmachinedisk_modepayload_profilegit_commit_sha
- Drift policy source:
benchmark/policies/drift_policy.json. - Profile-level drift overrides can be defined in
benchmark/profiles/*.json. - If baseline history count is below minimum, drift marks metric as
skipped_insufficient_baseline(not failed). - Guard checks include:
- formula invariants
- output path confinement
- output-matrix file evidence
- file I/O evidence
- sample duration checks
- root log leak detection
Severity by profile:
ci_smoke: advisorypr_gate: advisorynightly_truth: hard-fail on violations
Merge and investigation policy:
ci_smoke/pr_gatefailures should trigger investigation issues, not automatic merge blocks.nightly_truthfailures are merge/release blocking until resolved or explicitly waived.- Repeated advisory failures across consecutive PRs should be escalated to blocking review.
- Select profile by decision tier (
ci_smoke,pr_gate,nightly_truth). - Use profile-specific
--results-dirto avoid mixed histories. - Run benchmark and wait for completion artifact write.
- Inspect metadata and guard statuses before throughput comparison.
- Compare only same-profile, metadata-compatible runs.
- Capture benchmark evidence in PR/operations notes.
- Apply enforcement policy:
- advisory profile fail => investigate and track
- nightly profile fail => block release decision
- CI workflow (
.github/workflows/ci.yml) runs:ci_smokeon push and pull requestpr_gateon pull request
- Nightly workflow (
.github/workflows/benchmark-nightly.yml) runs:nightly_truthon schedule and manual dispatch
- Automation artifacts are uploaded from
benchmark/results/.
docs/benchmarks/CONTRACT.mddocs/benchmarks/MIGRATION.mddocs/PERFORMANCE.mddocs/OPERATIONS.md