Skip to content

Conversation

@chakra-guy
Copy link
Collaborator

@chakra-guy chakra-guy commented Jan 14, 2026

Summary

Adds three high-fidelity load testing scenarios for SLO validation using actual protocol clients (DappClient, WalletClient). These scenarios test the relay server from the application's perspective, not just raw WebSocket connections.

New Scenarios

Scenario Purpose Key Metrics
realistic-session Full dApp+Wallet handshake with message exchange Handshake latency, message RTT
async-delivery Historical message recovery after wallet disconnect/reconnect Recovery latency, delivery rate
steady-messaging Sustained message latency under load over time P99 latency trend, connection stability

Implementation Details

High-Fidelity Design

  • Uses actual DappClient and WalletClient from protocol libraries
  • Trusted mode connection flow (no OTP)
  • Realistic timing: 5s wallet connect delay (simulates QR scan), 1s message delay

Performance Optimizations

  • MockKeyManager: Bypasses real ECIES crypto (CPU-intensive) since the relay only sees opaque payloads
  • Reusable runWithPacing() utility for consistent ramp-up behavior across scenarios

New Files

  • client/session-pair.ts - Session pair creation and messaging
  • client/key-manager.ts - Mock crypto for load testing
  • utils/pacing.ts - Pacing utilities
  • utils/kvstore.ts - In-memory KV store
  • scenarios/realistic-session.ts, async-delivery.ts, steady-messaging.ts

Usage

Realistic session: handshake + message exchange

yarn start --scenario=realistic-session --target=ws://... --connections=100 --ramp-up=10 --messages-per-session=3

Async delivery: historical message recovery

yarn start --scenario=async-delivery --target=ws://... --connections=100 --ramp-up=10 --delay=30

Steady messaging: sustained load over time

yarn start --scenario=steady-messaging --target=ws://... --connections=100 --ramp-up=10 --duration=120 --message-interval=5


Note

Adds end-to-end scenarios using real protocol clients to validate relay performance and SLOs.

  • New scenarios: realistic-session, async-delivery, steady-messaging with pacing and progress bars
  • CLI: supports --connection-pairs, --messages-per-session, --delay, --message-interval; scenario-aware config and output
  • Output: extend TestResults and formatter to include handshake, messages, recovery, steadyMessaging, latency stats, and SLO PASS/FAIL indicators
  • Client utilities: client/session-pair.ts (pair handshake and message exchange), client/key-manager.ts (MockKeyManager), utils/kvstore.ts, utils/pacing.ts
  • Scenario implementations: scenarios/realistic-session.ts, async-delivery.ts, steady-messaging.ts; wiring via scenarios/index.ts
  • Dependencies: add protocol packages and eciesjs in package.json/yarn.lock

Written by Cursor Bugbot for commit 8bae672. This will update automatically on new commits. Configure here.

@chakra-guy chakra-guy force-pushed the ts/setup-load-testing branch 2 times, most recently from f75e1ab to fa791da Compare January 15, 2026 09:37
Base automatically changed from ts/setup-load-testing to main January 15, 2026 10:09
Add three new scenarios for SLO validation using actual protocol clients:

- realistic-session: Full dApp+Wallet handshake with message exchange
- async-delivery: Tests historical message recovery after wallet reconnect
- steady-messaging: Sustained message latency under load over time

Key implementation details:
- Uses MockKeyManager for lightweight crypto (CPU-efficient load generation)
- Realistic timing: 5s wallet connect delay, 1s message delay
- Reusable pacing utility (runWithPacing) for all scenarios
- InMemoryKVStore for session management

All scenarios verified against local Docker Compose with 100% success rates.
… waits before responding (simulates user reviewing request) - Each round: dApp sends → wallet waits → wallet responds → dApp receives - Response delay = message interval (e.g., 10s) - Latency measured excludes artificial delay (actual network time only) - Rounds run sequentially, no overlapping
Key changes:
- Each pair starts its messaging loop immediately upon connecting
- No synchronized bursts - load is naturally distributed
- Both sides wait: dApp sends → wallet waits → responds → dApp waits → repeat
- Message cycle takes 2 * messageInterval (e.g., 20s for 10s interval)
- Pairs connect during ramp-up and start messaging right away
- Metrics collected continuously with periodic snapshots
…tions

The protocol needs time to synchronize internal state before message
exchange can reliably work. 100ms was insufficient for production
connections with ~200ms latency. 500ms provides a reliable buffer.
@chakra-guy chakra-guy marked this pull request as ready for review January 20, 2026 12:00
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@chakra-guy chakra-guy merged commit e9a3036 into main Jan 20, 2026
12 checks passed
@chakra-guy chakra-guy deleted the ts/slo-load-testing branch January 20, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants