mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-26 09:35:52 +00:00
* fix: update Go CI workflow and fix formatting issues - Update Go version from 1.21.x to 1.24.x to match go.mod requirements - Fix Go module cache path to use linux/go.sum instead of **/go.sum - Run gofmt on all Go files to fix formatting issues - Fix benchmark files formatting - Fix linux/pkg/api/server.go formatting This resolves the GitHub Actions CI failures related to: - Missing go.sum file (wrong cache path) - Go version mismatch - Code formatting violations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: add platform-specific syscall.Select wrappers for Linux/Darwin compatibility - Create select_linux.go: handles syscall.Select returning (n int, err error) - Create select_darwin.go: handles syscall.Select returning (err error) - Update select.go to use platform-agnostic selectCall function - Resolves typecheck errors while maintaining compatibility on both platforms Tested on both macOS and Linux targets successfully. --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| client | ||
| cmd | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| quick-test.sh | ||
| README.md | ||
| vibetunnel-bench | ||
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
cd benchmark
go mod tidy
go build -o vibetunnel-bench .
Usage
Basic Connectivity Test
./vibetunnel-bench session --host localhost --port 4031 --count 5
Session Management Benchmark
# 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
# 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
# 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 sessionGET /api/sessions- List sessionsGET /api/sessions/{id}- Get session detailsPOST /api/sessions/{id}/input- Send inputGET /api/sessions/{id}/stream- SSE stream eventsDELETE /api/sessions/{id}- Delete session
Performance Testing Tips
- Start Small: Begin with low concurrency and short durations
- Monitor Resources: Watch server CPU, memory, and network usage
- Baseline First: Test single-user performance before load testing
- Network Latency: Account for network latency in benchmarks
- 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