Each example demonstrates ONE specific BenchBox capability
This directory contains focused examples that each teach a single feature or capability of BenchBox. Unlike the getting_started examples which provide end-to-end workflows, these examples isolate specific features to make learning easier.
- One feature per example - Each script focuses on a single capability
- Practical and runnable - All examples are complete, working programs
- Well-commented - Inline documentation explains why, not just what
- Build on basics - Assumes you've completed getting_started examples
1. Test Types (test_types.py)
Feature: Different test execution types (power, throughput, maintenance) Learn: When to use each test type
python features/test_types.pyKey Concepts:
- Power test: Sequential query execution for latency measurement
- Throughput test: Concurrent streams for capacity testing
- Maintenance test: Data modification operations
2. Maintenance Workflow (maintenance_workflow.py)
Feature: Complete workflow with Maintenance Test and database reload Learn: Proper test sequencing and database state management
python features/maintenance_workflow.pyKey Concepts:
- Complete Power → Throughput → Maintenance sequence
- Database state verification (row count tracking)
- Why reload is required after Maintenance
- Correct vs incorrect test workflows
- Interactive demonstration of data modifications
Important: This example shows the critical reload requirement after Maintenance tests.
3. Query Subset (query_subset.py)
Feature: Run specific queries instead of full benchmark suite Learn: Targeted testing for development and debugging
python features/query_subset.pyKey Concepts:
--queriesflag usage- Quick smoke tests (2-3 queries)
- Debugging specific slow queries
- CI/CD integration with fast subsets
3. Tuning Comparison (tuning_comparison.py)
Feature: Compare tuned vs baseline performance Learn: Quantify optimization impact
python features/tuning_comparison.pyKey Concepts:
- Tuning configuration files
- Before/after comparison
- Performance improvement measurement
- Cost/benefit analysis of optimizations
4. Result Analysis (result_analysis.py)
Feature: Load and compare benchmark results Learn: Analyze performance changes over time
python features/result_analysis.pyKey Concepts:
- Result JSON format
- Loading previous results
- Query-by-query comparison
- Regression detection
- Statistical analysis
5. Multi-Platform (multi_platform.py)
Feature: Run same benchmark on multiple platforms Learn: Platform comparison workflow
python features/multi_platform.pyKey Concepts:
- Platform iteration
- Result collection across platforms
- Performance comparison
- Platform selection decision-making
6. Export Formats (export_formats.py)
Feature: Export results in JSON, CSV, HTML Learn: Result export and reporting
python features/export_formats.pyKey Concepts:
--formatsflag usage- JSON for programmatic processing
- CSV for spreadsheet analysis
- HTML for stakeholder reports
7. Data Validation (data_validation.py)
Feature: Enable data quality checks Learn: Ensure data integrity
python features/data_validation.pyKey Concepts:
- Preflight validation (before generation)
- Postgen validation (after generation)
- Postload validation (after database load)
- Row count verification
- Data quality checks
8. Performance Monitoring (performance_monitoring.py)
Feature: Monitor system resources during execution Learn: Resource usage tracking
python features/performance_monitoring.pyKey Concepts:
- System profiling
- CPU usage tracking
- Memory usage tracking
- Resource requirement estimation
Recommended order for learning features:
- Start:
test_types.py- Understand different execution modes - Next:
query_subset.py- Learn targeted testing - Then:
tuning_comparison.py- See optimization impact - Advanced:
result_analysis.py- Analyze performance changes - Multi-platform:
multi_platform.py- Compare databases - Reporting:
export_formats.py- Generate reports - Quality:
data_validation.py- Ensure correctness - Performance:
performance_monitoring.py- Track resources
# Run a feature example to see it in action
python features/query_subset.py
# Most examples complete in < 1 minute# Copy an example to experiment
cp features/tuning_comparison.py my_experiment.py
# Modify parameters, scale factors, platforms
# All examples are self-contained# Feature examples show patterns you can use in your code
# Copy the relevant sections into your scriptsAll feature examples follow a consistent structure:
"""
Brief description of the feature.
Usage:
python features/example.py
Key Concepts:
- Concept 1
- Concept 2
"""
# 1. Setup section with clear comments
# 2. Feature demonstration with explanations
# 3. Result display showing what to look for
# 4. Tips section with best practices- Complete getting_started examples first
- Understand basic BenchBox concepts
- Python 3.10+ installed
- BenchBox installed:
uv add benchbox
After mastering these features, explore:
- use_cases/ - Real-world problem-solving patterns
- programmatic/ - Using BenchBox as a library
- PATTERNS.md - Combined workflow patterns
- unified_runner.py - Production-ready tool
- Run examples as-is first - See the feature in action before modifying
- Read inline comments - They explain why, not just what
- Experiment with parameters - Change scale factors, platforms, etc.
- Combine features - Use multiple features together in your workflows
- Check exit codes - Examples return 0 on success for CI/CD integration
Q: Can I combine multiple features? A: Yes! See PATTERNS.md for combinations.
Q: How do these relate to unified_runner.py? A: These examples show individual features. unified_runner.py combines all features in one tool.
Q: Should I use these in production? A: These are educational examples. For production, use unified_runner.py or build your own based on these patterns.
Q: Can I modify these examples? A: Absolutely! They're designed to be copied and adapted for your needs.
Have a feature that needs a focused example? Submit a PR following this pattern:
- One feature per example
- Complete, runnable code
- Inline comments explaining concepts
- Usage section in docstring
- Update this README with your example
Remember: Each example teaches ONE feature in depth. For complete workflows combining features, see PATTERNS.md.