Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(logql): Add LogQL Benchmark Suite #16434

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

cyriltovena
Copy link
Contributor

This PR introduces a comprehensive benchmark suite for LogQL, Loki's query language. The suite is designed to help measure and improve the performance of LogQL queries by providing tools to generate realistic log data and benchmark various query patterns against different storage implementations.

What this PR does

  • Adds a complete benchmark suite for LogQL in pkg/logql/bench/
  • Provides tools to generate synthetic log data with configurable cardinality and patterns
  • Implements multiple storage backends for comparison (chunk-based and dataobj columnar)
  • Includes a variety of benchmark queries covering log filtering, pattern extraction, and metrics
  • Adds a comprehensive README with usage instructions and architecture details
  • Includes Makefile targets for easy data generation and benchmark execution

Why this is valuable

This benchmark suite will help:

  1. Measure performance impact of changes: Developers can use this to measure the performance impact of changes to the LogQL engine
  2. Compare storage implementations: The suite allows comparing different storage implementations to identify optimization opportunities
  3. Identify bottlenecks: The profiling capabilities help identify performance bottlenecks in the query execution
  4. Regression testing: The suite can be used to detect performance regressions before they reach production

Key features

  • Reproducible datasets: Uses a fixed random seed to ensure benchmark results are comparable across different runs and environments
  • Realistic log patterns: Generates logs that mimic real-world applications like nginx, postgres, java, etc.
  • Multiple storage formats: Supports different storage implementations for performance comparison
  • Comprehensive query types: Tests various LogQL features including filtering, pattern extraction, and metrics
  • Extensible framework: Easy to add new application types, storage implementations, and query patterns

How to use it

  1. Generate test data: make -C pkg/logql/bench generate
  2. Run benchmarks through the CLI: make -C pkg/logql/bench run
  3. For more options, see the README in pkg/logql/bench/

Future improvements

  • Integrate with CI for automated performance regression testing
  • Add more complex query patterns as LogQL evolves with new data example.

CLI

This PR comes with a a CLI tools to select which benchmark to run, compare result, re-run and see performance profiles.

To use it run make run

image image

…ase struct and GenerateTestCases public for reuse, add Name() and Description() methods, sort test cases by name, simplify output format
…ce, and multi-store support

- Add determinism test for log generator to ensure consistent dataset generation
- Implement config save/load functionality for generator configuration
- Modify Builder to support multiple stores and save generator config
- Update Generator to use configurable seed for reproducibility
- Add default seed and configuration options to improve generator flexibility
- Fix list view being cut off when returning from run view

- Ensure proper window size handling during view transitions

- Maintain viewport dimensions when switching between views

- Add proper cleanup and reinitialization of views

- Improve list view refresh to maintain state and dimensions

- Fix buffer refresh issues with tea.ClearScreen
@cyriltovena cyriltovena requested a review from a team as a code owner February 25, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant