# Performance Benchmarking Guide with HTML Reporting This guide explains how to run performance benchmarks for predict-otron-9000 and generate HTML reports for easy visualization and analysis. ## Overview The predict-otron-9000 system consists of three main components: 1. **predict-otron-9000**: The main server that integrates the other components 2. **embeddings-engine**: Generates text embeddings using the Nomic Embed Text v1.5 model 3. **inference-engine**: Handles text generation using various Gemma models We have two benchmark scripts that test these components under different conditions: - `performance_test_embeddings.sh`: Tests embedding generation with different input sizes - `performance_test_inference.sh`: Tests text generation with different prompt sizes This guide extends the existing benchmarking functionality by adding HTML report generation for better visualization and sharing of results. ## Prerequisites - Rust 1.70+ with 2024 edition support - Cargo package manager - Node.js 16+ (for HTML report generation) - Basic understanding of the system architecture - The project built with `cargo build --release` ## Step 1: Installing Required Tools First, you'll need to install the necessary tools for HTML report generation: ```bash # Install Chart.js for visualizations npm install -g chart.js # Install a simple HTTP server to view reports locally npm install -g http-server ``` ## Step 2: Running Performance Tests The benchmarking process has two phases: running the tests and generating HTML reports from the results. ### Start the Server ```bash # Start the server in a terminal window ./run_server.sh ``` Wait for the server to fully initialize (look for "server listening" message). ### Run Embedding Performance Tests In a new terminal window: ```bash # Run the embeddings performance test ./performance_test_embeddings.sh ``` Note the temporary directory path where results are stored. You'll need this for the HTML generation. ### Run Inference Performance Tests ```bash # Run the inference performance test ./performance_test_inference.sh ``` Again, note the temporary directory path where results are stored. ## Step 3: Generating HTML Reports Now you'll convert the test results into HTML reports. Use the script below to transform the benchmark data. Create a file named `generate_benchmark_report.sh` in the project root: ```bash #!/bin/bash # Create a new benchmark report script cat > generate_benchmark_report.sh << 'EOF' #!/bin/bash # Script to generate HTML performance reports from benchmark results # Check if results directory was provided if [ -z "$1" ]; then echo "Error: Please provide the directory containing benchmark results." echo "Usage: $0 /path/to/results/directory" exit 1 fi RESULTS_DIR="$1" OUTPUT_DIR="benchmark_reports" TIMESTAMP=$(date +"%Y%m%d_%H%M%S") REPORT_DIR="${OUTPUT_DIR}/${TIMESTAMP}" # Create output directories mkdir -p "${REPORT_DIR}" # Function to extract data from results files extract_data() { local test_type="$1" local data_file="${REPORT_DIR}/${test_type}_data.js" echo "// ${test_type} benchmark data" > "$data_file" echo "const ${test_type}Labels = [];" >> "$data_file" echo "const ${test_type}Times = [];" >> "$data_file" # Find all result files for this test type for result_file in "${RESULTS_DIR}"/*_results.txt; do if [ -f "$result_file" ]; then # Extract test size/name size=$(basename "$result_file" | sed 's/_results.txt//') # Extract average time avg_time=$(grep "Average time for $size" "$result_file" | awk '{print $6}') if [ -n "$avg_time" ]; then echo "${test_type}Labels.push('$size');" >> "$data_file" echo "${test_type}Times.push($avg_time);" >> "$data_file" fi fi done } # Generate the HTML report create_html_report() { local html_file="${REPORT_DIR}/index.html" cat > "$html_file" << HTML
Generated on: $(date)
This report shows performance benchmarks for the predict-otron-9000 system, measuring both embedding generation and text inference capabilities across different input sizes.
Average response times for generating embeddings with different input sizes.
Average response times for text generation with different prompt sizes.
Input Size | Average Response Time (s) |
---|
Prompt Size | Average Response Time (s) |
---|
$(uname -s) $(uname -m)
CPU: $(grep 'model name' /proc/cpuinfo 2>/dev/null | head -1 | cut -d: -f2 || sysctl -n machdep.cpu.brand_string 2>/dev/null || echo "Unknown")
Rust Version: $(rustc --version)
predict-otron-9000 Version: $(grep 'version' Cargo.toml | head -1 | cut -d'"' -f2 || echo "Unknown")