Rate Limit and Throttle WAI Requests
main = do
st <- initThrottler
let payload = "{ \"api\", \"return data\" }"
app = throttle defaultThrottleSettings st
$ \_ f -> f (responseLBS status200 [] payload)
Warp.run 3000 app
- [ ] support for X-RateLimit-Limit and X-RateLimit-Remaining headers Whether or not they have these specific names
- [ ] Burst or Sustained throttling similar to the Django
throttling framework:
REST_FRAMEWORK = { 'DEFAULT_THROTTLE_CLASSES': ( 'example.throttles.BurstRateThrottle', 'example.throttles.SustainedRateThrottle' ), 'DEFAULT_THROTTLE_RATES': { 'burst': '60/min', 'sustained': '1000/day' } }
- [ ] Zoned throttling
- multiple zones
http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; ... server { ... location /search/ { limit_req zone=one burst=5; }
- [ ] cache with size limit for managing the remote addresses