Files
the-nexus/experiments/results_5user_concurrent.md

90 lines
2.2 KiB
Markdown

# Experiment: 5-User Concurrent Session Isolation
**Date:** 2026-04-12
**Bridge version:** feat/multi-user-bridge (5442d5b)
**Hardware:** macOS, local aiohttp server
## Configuration
| Parameter | Value |
|-----------|-------|
| Concurrent users | 5 |
| Messages per user | 20 |
| Total messages | 100 |
| Rooms tested | Tower, Chapel, Library, Garden, Dungeon |
| Bridge endpoint | http://127.0.0.1:4004 |
## Results
### Throughput & Latency
| Metric | Value |
|--------|-------|
| Throughput | 9,570.9 msg/s |
| Latency p50 | 0.4 ms |
| Latency p95 | 1.1 ms |
| Latency p99 | 1.4 ms |
| Wall time (100 msgs) | 0.010s |
| Errors | 0 |
### Session Isolation
| Test | Result |
|------|--------|
| Independent response streams | ✅ PASS |
| 5 active sessions tracked | ✅ PASS |
| No cross-user history leakage | ✅ PASS |
| Per-session message counts correct | ✅ PASS |
### Room Occupancy
| Test | Result |
|------|--------|
| Concurrent look returns consistent occupants | ✅ PASS |
| All 5 users see same 5-member set | ✅ PASS |
### Crisis Detection Under Load
| Test | Result |
|------|--------|
| Crisis detected on turn 3 | ✅ PASS |
| 988 message included in response | ✅ PASS |
| Detection unaffected by concurrent load | ✅ PASS |
## Analysis
The multi-user bridge achieves **sub-millisecond latency** at ~9,500 msg/s for 5 concurrent users. Session isolation holds perfectly — no user sees another's history or responses. Crisis detection triggers correctly at the configured 3-turn threshold even under concurrent load.
The bridge's aiohttp-based architecture handles concurrent requests efficiently with negligible overhead. Room occupancy tracking is consistent when users are pre-positioned before concurrent queries.
## Reproduction
```bash
# Start bridge
python nexus/multi_user_bridge.py --port 4004 &
# Run benchmark
python experiments/benchmark_concurrent_users.py
# Kill bridge
pkill -f multi_user_bridge
```
## JSON Results
```json
{
"users": 5,
"messages_per_user": 20,
"total_messages": 100,
"total_errors": 0,
"throughput_msg_per_sec": 9570.9,
"latency_p50_ms": 0.4,
"latency_p95_ms": 1.1,
"latency_p99_ms": 1.4,
"wall_time_sec": 0.01,
"session_isolation": true,
"crisis_detection": true
}
```