Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm in the process of developing a scalable proxy (Linux/C/C++, Nginx modules or custom HTTP server) handling incoming HTTP requests, and re-routing them to others locations based on parameters included in the incoming request itself (IP, time for example) or external factors (hence the use of an Nginx module able to retrieve the external factors).

However, the tricky part is regarding quotas. For example, I wish I could block proxying requests originating from an IP when it's daily allowance quota is over.

Implementing quotas is not hard. However, having quotas work in a distributed environment (where ideally everything is shared-nothing) is far from trivial. Indeed, the quota state must be shared to all distributed processes so that they can know whether they should proceed or not. Having a central quota handler means using locks. This makes me think that the performances will drop very quickly. Locking the quotas status every time a proxying request is being handled doesn't look like the solution to me.

Any hints ?

share|improve this question

1 Answer 1

You could give distributed Erlang /OTP a try. You would write your proxy logic in Erlang.

You can maintain your "quotas" in Mnesia tables. Mnesia can be distributed over different Erlang nodes across the network. You can also control wether you need to lock the table while reading or writing.

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.