Test suite for reproducing and measuring P99.9 latency spikes in the Unleash Go SDK under high-concurrency conditions.
- Go 1.23+
- Access to an Unleash server
- A valid API token
The tests can be configured via environment variables:
| Variable | Default | Description |
|---|---|---|
UNLEASH_URL |
yoururl |
Unleash API URL |
UNLEASH_API_TOKEN |
yourtoken |
Your Unleash API token |
UNLEASH_APP_NAME |
p999-spike-test |
Application name for the client |
FEATURE_NAME |
yourfeature |
Feature flag to evaluate |
go test -vTests latency by firing concurrent bursts of requests:
go test -v -run TestP999LatencySpikeThis test:
- Fires bursts of 1000 workers × 100 calls = 100,000 requests per burst
- Runs for 4 minutes with bursts every 2 seconds
- Reports percentile latencies (P50, P95, P99, P99.9, P99.99)
- Flags spikes when P99.9 exceeds 10ms
Tests latency under sustained high-concurrency traffic:
go test -v -run TestContinuousHighConcurrencyWith configurable GOGC:
GOGC=400 go test -v -run TestContinuousHighConcurrencyThis test:
- Maintains 1000 concurrent workers making continuous requests
- Runs for 4 minutes
- Reports per-second windows with elevated latencies
UNLEASH_URL=http://localhost:4242/api \
UNLEASH_API_TOKEN=your-token \
FEATURE_NAME=my-feature \
go test -v -run TestP999LatencySpikeWith configurable GOGC:
UNLEASH_URL=http://localhost:4242/api \
UNLEASH_API_TOKEN=your-token \
FEATURE_NAME=my-feature \
GOGC=400 go test -v -run TestP999LatencySpike