mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-01 10:35:56 +00:00
* Add comprehensive VibeTunnel protocol benchmark tool Features: - Complete HTTP API client implementation for VibeTunnel protocol - Session management benchmarks (create/get/list/delete operations) - SSE streaming performance testing with latency measurements - Concurrent user load testing with realistic simulation - Support for custom hostname/port configuration - Detailed performance statistics and reporting Commands: - session: Test session lifecycle performance - stream: Benchmark SSE streaming latency/throughput - load: Concurrent user load testing Tested against both Go (port 4031) and Rust (port 4044) servers. Tool successfully creates sessions and measures performance metrics. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Add configurable benchmark comparison tool Features: - Compare command with 10-100 configurable runs - Cross-server API compatibility (Go/Rust fields) - Session management and streaming benchmarks - Performance analysis and winner detection - Comprehensive statistics and throughput metrics Results show Go server ~27-50% faster than Rust for session operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove API compatibility shims for clean unified format - Unified SessionConfig to use Rust API format (command, workingDir) - Updated all benchmark commands to use clean API - Go and Rust servers now use identical API format - 100-run test shows near-identical performance (1% difference) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Enable high-load testing up to 1000 runs - Increased run limit from 100 to 1000 for stress testing - Reveals resource exhaustion under extreme load - Go server: 203/1000 success in first round, then failures - Rust server: immediate failure under high load - Both servers need connection pooling/rate limiting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
177 lines
No EOL
4.8 KiB
Markdown
177 lines
No EOL
4.8 KiB
Markdown
# VibeTunnel Protocol Benchmark Tool
|
|
|
|
A comprehensive benchmarking tool for testing VibeTunnel server performance and protocol compliance.
|
|
|
|
## Features
|
|
|
|
- **Session Management**: Test session creation, retrieval, and deletion performance
|
|
- **SSE Streaming**: Benchmark Server-Sent Events streaming latency and throughput
|
|
- **Concurrent Load**: Simulate multiple users for load testing
|
|
- **Protocol Compliance**: Full VibeTunnel HTTP API client implementation
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
cd benchmark
|
|
go mod tidy
|
|
go build -o vibetunnel-bench .
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Basic Connectivity Test
|
|
```bash
|
|
./vibetunnel-bench session --host localhost --port 4031 --count 5
|
|
```
|
|
|
|
### Session Management Benchmark
|
|
```bash
|
|
# Test session lifecycle with 10 sessions
|
|
./vibetunnel-bench session --host localhost --port 4031 --count 10 --verbose
|
|
|
|
# Custom shell and working directory
|
|
./vibetunnel-bench session --host localhost --port 4031 --shell /bin/zsh --cwd /home/user
|
|
```
|
|
|
|
### SSE Streaming Benchmark
|
|
```bash
|
|
# Test streaming performance with 3 concurrent sessions
|
|
./vibetunnel-bench stream --host localhost --port 4031 --sessions 3 --duration 30s
|
|
|
|
# Sequential streaming test
|
|
./vibetunnel-bench stream --host localhost --port 4031 --sessions 5 --concurrent=false
|
|
|
|
# Custom commands to execute
|
|
./vibetunnel-bench stream --host localhost --port 4031 --commands "echo test,ls -la,date"
|
|
```
|
|
|
|
### Concurrent Load Testing
|
|
```bash
|
|
# Simulate 20 concurrent users for 2 minutes
|
|
./vibetunnel-bench load --host localhost --port 4031 --concurrent 20 --duration 2m
|
|
|
|
# Load test with custom ramp-up period
|
|
./vibetunnel-bench load --host localhost --port 4031 --concurrent 50 --duration 5m --ramp-up 30s
|
|
```
|
|
|
|
## Command Reference
|
|
|
|
### Global Flags
|
|
- `--host`: Server hostname (default: localhost)
|
|
- `--port`: Server port (default: 4026)
|
|
- `--verbose, -v`: Enable detailed output
|
|
|
|
### Session Command
|
|
- `--count, -c`: Number of sessions to create (default: 10)
|
|
- `--shell`: Shell to use (default: /bin/bash)
|
|
- `--cwd`: Working directory (default: /tmp)
|
|
- `--width`: Terminal width (default: 80)
|
|
- `--height`: Terminal height (default: 24)
|
|
|
|
### Stream Command
|
|
- `--sessions, -s`: Number of sessions to stream (default: 3)
|
|
- `--duration, -d`: Benchmark duration (default: 30s)
|
|
- `--commands`: Commands to execute (default: ["echo hello", "ls -la", "date"])
|
|
- `--concurrent`: Run streams concurrently (default: true)
|
|
- `--input-delay`: Delay between commands (default: 2s)
|
|
|
|
### Load Command
|
|
- `--concurrent, -c`: Number of concurrent users (default: 10)
|
|
- `--duration, -d`: Load test duration (default: 60s)
|
|
- `--ramp-up`: Ramp-up period (default: 10s)
|
|
|
|
## Example Output
|
|
|
|
### Session Benchmark
|
|
```
|
|
🚀 VibeTunnel Session Benchmark
|
|
Target: localhost:4031
|
|
Sessions: 10
|
|
|
|
Testing connectivity... ✅ Connected
|
|
|
|
📊 Session Lifecycle Benchmark
|
|
✅ Created 10 sessions in 0.45s
|
|
✅ Retrieved 10 sessions in 0.12s
|
|
✅ Listed 47 sessions in 2.34ms
|
|
✅ Deleted 10 sessions in 0.23s
|
|
|
|
📈 Performance Statistics
|
|
Overall Duration: 0.81s
|
|
|
|
Operation Latencies (avg/min/max in ms):
|
|
Create: 45.23 / 38.12 / 67.89
|
|
Get: 12.45 / 8.23 / 18.67
|
|
Delete: 23.78 / 19.45 / 31.23
|
|
|
|
Throughput:
|
|
Create: 22.3 sessions/sec
|
|
Get: 83.4 requests/sec
|
|
Delete: 43.5 sessions/sec
|
|
```
|
|
|
|
### Stream Benchmark
|
|
```
|
|
🚀 VibeTunnel SSE Stream Benchmark
|
|
Target: localhost:4031
|
|
Sessions: 3
|
|
Duration: 30s
|
|
Concurrent: true
|
|
|
|
📊 Concurrent SSE Stream Benchmark
|
|
|
|
📈 Stream Performance Statistics
|
|
Total Duration: 30.12s
|
|
|
|
Overall Results:
|
|
Sessions: 3 total, 3 successful
|
|
Events: 1,247 total
|
|
Data: 45.67 KB
|
|
Errors: 0
|
|
|
|
Latency (average):
|
|
First Event: 156.3ms
|
|
Last Event: 29.8s
|
|
|
|
Throughput:
|
|
Events/sec: 41.4
|
|
KB/sec: 1.52
|
|
Success Rate: 100.0%
|
|
|
|
✅ All streams completed successfully
|
|
```
|
|
|
|
## Protocol Implementation
|
|
|
|
The benchmark tool implements the complete VibeTunnel HTTP API:
|
|
|
|
- `POST /api/sessions` - Create session
|
|
- `GET /api/sessions` - List sessions
|
|
- `GET /api/sessions/{id}` - Get session details
|
|
- `POST /api/sessions/{id}/input` - Send input
|
|
- `GET /api/sessions/{id}/stream` - SSE stream events
|
|
- `DELETE /api/sessions/{id}` - Delete session
|
|
|
|
## Performance Testing Tips
|
|
|
|
1. **Start Small**: Begin with low concurrency and short durations
|
|
2. **Monitor Resources**: Watch server CPU, memory, and network usage
|
|
3. **Baseline First**: Test single-user performance before load testing
|
|
4. **Network Latency**: Account for network latency in benchmarks
|
|
5. **Realistic Workloads**: Use commands and data patterns similar to production
|
|
|
|
## Troubleshooting
|
|
|
|
### Connection Refused
|
|
- Verify server is running: `curl http://localhost:4031/api/sessions`
|
|
- Check firewall and port accessibility
|
|
|
|
### High Error Rates
|
|
- Reduce concurrency level
|
|
- Increase timeouts
|
|
- Check server logs for resource limits
|
|
|
|
### Inconsistent Results
|
|
- Run multiple iterations and average results
|
|
- Ensure stable network conditions
|
|
- Close other applications using system resources |