[model-gateway] Improve tree benchmark with realistic multi-tenant scenarios (#14838)
This commit is contained in:
@@ -281,9 +281,85 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: sccache --show-stats
|
run: sccache --show-stats
|
||||||
|
|
||||||
|
benchmark-tree:
|
||||||
|
name: Tree Benchmark
|
||||||
|
if: |
|
||||||
|
github.repository == 'sgl-project/sglang' &&
|
||||||
|
(github.event_name == 'push' ||
|
||||||
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
(contains(github.event.pull_request.labels.*.name, 'router-benchmark') &&
|
||||||
|
contains(github.event.pull_request.labels.*.name, 'run-ci')))
|
||||||
|
# Use 4-core runner for concurrent benchmarks that spawn multiple threads
|
||||||
|
runs-on: 4-gpu-a10
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 100
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
bash scripts/ci/ci_install_rust.sh
|
||||||
|
|
||||||
|
- name: Configure sccache
|
||||||
|
uses: mozilla-actions/sccache-action@v0.0.9
|
||||||
|
with:
|
||||||
|
version: "v0.10.0"
|
||||||
|
|
||||||
|
- name: Rust cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: sgl-model-gateway
|
||||||
|
# Share cache across all benchmark jobs
|
||||||
|
shared-key: "rust-cache"
|
||||||
|
cache-all-crates: true
|
||||||
|
cache-on-failure: true
|
||||||
|
# Save cache even on failure
|
||||||
|
save-if: true
|
||||||
|
|
||||||
|
- name: Run tree benchmark
|
||||||
|
timeout-minutes: 30
|
||||||
|
run: |
|
||||||
|
source "$HOME/.cargo/env"
|
||||||
|
cd sgl-model-gateway/
|
||||||
|
# Try to use sccache, but disable if it fails
|
||||||
|
if command -v sccache &> /dev/null; then
|
||||||
|
echo "Testing sccache availability..."
|
||||||
|
# Try to start sccache and check if it works
|
||||||
|
export RUSTC_WRAPPER=sccache
|
||||||
|
export SCCACHE_GHA_ENABLED="true"
|
||||||
|
if sccache --start-server 2>/dev/null && sccache --show-stats 2>/dev/null; then
|
||||||
|
echo "sccache is working, using it for compilation"
|
||||||
|
else
|
||||||
|
echo "sccache failed to start, falling back to regular cargo"
|
||||||
|
unset RUSTC_WRAPPER
|
||||||
|
unset SCCACHE_GHA_ENABLED
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "sccache not available, using regular cargo"
|
||||||
|
fi
|
||||||
|
# Run summary benchmark for quick validation in CI
|
||||||
|
# Note: Don't use --exact because benchmark names are prefixed (benchmark_summary/insert_realistic)
|
||||||
|
# Capture output to file for CI summary
|
||||||
|
cargo bench --bench tree_benchmark -- benchmark_summary 2>&1 | tee benchmark_output.txt
|
||||||
|
|
||||||
|
- name: Upload benchmark results
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: tree-results-${{ github.sha }}
|
||||||
|
path: |
|
||||||
|
sgl-model-gateway/target/criterion/benchmark_summary*/
|
||||||
|
sgl-model-gateway/benchmark_output.txt
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Show sccache stats
|
||||||
|
if: always()
|
||||||
|
run: sccache --show-stats
|
||||||
|
|
||||||
benchmark-summary:
|
benchmark-summary:
|
||||||
name: Benchmark Summary
|
name: Benchmark Summary
|
||||||
needs: [benchmark-request-processing, benchmark-tokenizer, benchmark-tool-parser]
|
needs: [benchmark-request-processing, benchmark-tokenizer, benchmark-tool-parser, benchmark-tree]
|
||||||
if: always() && (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request')
|
if: always() && (github.repository == 'sgl-project/sglang' || github.event_name == 'pull_request')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -359,6 +435,31 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "❌ Failed or skipped" >> summary.md
|
echo "❌ Failed or skipped" >> summary.md
|
||||||
fi
|
fi
|
||||||
|
echo "" >> summary.md
|
||||||
|
|
||||||
|
# Tree Benchmark
|
||||||
|
echo "### Radix Tree (Cache-Aware Routing)" >> summary.md
|
||||||
|
TREE_DIR="benchmark-results/tree-results-${{ github.sha }}"
|
||||||
|
if [ -d "$TREE_DIR" ]; then
|
||||||
|
echo "✅ **Completed**" >> summary.md
|
||||||
|
if [ -f "$TREE_DIR/benchmark_output.txt" ]; then
|
||||||
|
echo "" >> summary.md
|
||||||
|
echo "<details>" >> summary.md
|
||||||
|
echo "<summary>View Results</summary>" >> summary.md
|
||||||
|
echo "" >> summary.md
|
||||||
|
echo '```' >> summary.md
|
||||||
|
# Extract benchmark results (printed incrementally during run)
|
||||||
|
echo "=== Summary Results ===" >> summary.md
|
||||||
|
grep "\[BENCH_RESULT\] summary" "$TREE_DIR/benchmark_output.txt" | sed 's/\[BENCH_RESULT\] //' >> summary.md || true
|
||||||
|
echo "" >> summary.md
|
||||||
|
# Also show the full summary table if available
|
||||||
|
grep -A 100 "RADIX TREE BENCHMARK SUMMARY\|CI SUMMARY" "$TREE_DIR/benchmark_output.txt" | head -60 >> summary.md || cat "$TREE_DIR/benchmark_output.txt" | tail -60 >> summary.md
|
||||||
|
echo '```' >> summary.md
|
||||||
|
echo "</details>" >> summary.md
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ Failed or skipped" >> summary.md
|
||||||
|
fi
|
||||||
|
|
||||||
echo "" >> summary.md
|
echo "" >> summary.md
|
||||||
echo "---" >> summary.md
|
echo "---" >> summary.md
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user