Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to implement a throttling feature on nginx, that is shared across multiple servers across multiple datacenters. I would like to know what would be the best practice for building this.

For example, let's say that I have an HTTP API running on two cluster of servers (behind a load balancer) located in two different datacenters. I would like to throttle a developer by his api-key to 1000 requests/hour. The developer has built a mobile application, which means that depending where his final users are, requests will be server by both locations (the closest datacenter).

How would you enforce throttling in this particular scenario?

share|improve this question
    
Would the throttling not be better suited to being handled by the actual application/backend? Remember you're dealing with a web server, your not implementing complex logic in it. –  jduncanator Apr 13 at 8:31

1 Answer 1

The easiest way would be to implement throttling in each of N data centers separately. In your case M=1000 requests/hour and N=2 data centers. So, just use M/N=500 as your throttle value.

See: NGINX - throttle requests to prevent abuse

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.