This directory contains k6 load testing scripts for comparing v1 and v2 Unkey APIs.
Tests the ratelimiting endpoints with random identifiers.
UNKEY_ROOT_KEY=your_key REGION=us-east k6 cloud ratelimit.jsFeatures:
- 50/50 split between v1 (
api.unkey.dev) and v2 (api.unkey.com) APIs - Random user identifiers from pool of 5 users
- Tests
/v1/ratelimits.limitvs/v2/ratelimit.limit
Tests the key verification endpoints.
UNKEY_ROOT_KEY=your_key KEY=your_test_key k6 cloud keyverify.jsFeatures:
- 50/50 split between v1 and v2 APIs
- Tests
/v1/keys.verifyKeyvs/v2/keys.verifyKey
- Install k6:
brew install k6 - Set up k6 Cloud account and configure project ID in scripts
- Configure environment variables
UNKEY_ROOT_KEY- Required. Your Unkey root API keyKEY- Required for keyverify.js. Test key to verify
- Duration: 10 minutes at 10 req/s
- Load zones: Currently US East only (others commented out)
- Thresholds: P95 < 500ms, 99% success rate
- Project ID: 3788521 (update as needed)
request_latency- Custom trend metric with URL and region tags- Built-in k6 HTTP metrics (duration, success rate, etc.)
- All metrics automatically available in Grafana Cloud