Skip to content

[FEATURE] Add k6 WebSocket performance tests for rate limiter #469

@saniddhyaDubey

Description

@saniddhyaDubey

Is your feature request related to a problem? Please describe.
Currently there is no way to performance test the rate limiter under real concurrent load. Unit and integration tests verify logic and correctness but cannot simulate thousands of simultaneous WebSocket connections hitting the relay at the same time. This makes it hard to verify, whether the rate limiter i.e. EWMA or sliding window, work appropriately under high traffics.

Describe the solution you'd like
Set up k6 with WebSocket support (xk6-websockets or the built-in k6 WebSocket API) to simulate concurrent virtual users connecting to the relay and sending events. The test script should:

  • Spin up configurable number of virtual users simultaneously.
  • Each user opens a WebSocket connection and sends Nostr events.
  • Collect metrics i.e. accepted requests, rate limited rejections, response times.
  • Verify rate limiter correctly enforces limits under concurrent load.
  • Support testing both ewma and sliding_window strategies

Additional context
This is particularly useful for validating the EWMA rate limiter implementation introduced in issue #404 under realistic high-traffic conditions that integration tests cannot simulate efficiently.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions