Skip to content

test(loki.process): Add benchmarks to test performance with a large number of stage.match components - #6879

Open
csmarchbanks wants to merge 1 commit into
mainfrom
loki-process-benchmarks
Open

test(loki.process): Add benchmarks to test performance with a large number of stage.match components#6879
csmarchbanks wants to merge 1 commit into
mainfrom
loki-process-benchmarks

Conversation

@csmarchbanks

@csmarchbanks csmarchbanks commented Aug 13, 2026

Copy link
Copy Markdown

Brief description of Pull Request

Adds three benchmarks to internal/component/loki/process/stages/pipeline_test.go, with no production code changes:

  • BenchmarkPipelineManyRules — per-entry latency for a single stream through a pipeline built from a sweep of stage.match rule counts (1 to 1000).
  • BenchmarkPipelineOneMultilineAmongManyRules — the same, with one stage.multiline rule mixed in at different positions among 1000 otherwise-uniform rules.
  • BenchmarkPipelineManyStreamsSaturated — aggregate throughput (entries/sec) across many concurrent streams competing for the same cores, which is where the current one-goroutine-and-channel-per-stage cost shows up most under real load.

Pull Request Details

We are trying to move adaptive logs into the client and ran into performance issues when there are lots of stage.match entries. This adds benchmarks for those cases so we can improve the performance.

Notes to the Reviewer

This is the shared baseline that #6873 and #6875 (and a further change) each build on: every commit that follows on top of this one reports its own before/after benchstat comparison against this commit specifically.

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated
  • This pull request was substantially generated with AI assistance (see the GenAI policy)

…ages

Adaptive-logs style configurations can compile down to a loki.process
pipeline with hundreds of stage.match rules, and each stage hands entries
off through its own unbuffered channel and goroutine. These benchmarks make
that per-stage handoff cost measurable, for a single stream
(BenchmarkPipelineManyRules), for one rule among many needing its own
channel (BenchmarkPipelineOneMultilineAmongManyRules), and for many
concurrent streams competing for the same cores
(BenchmarkPipelineManyStreamsSaturated).

Assisted-by: Claude Sonnet 5
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