How do I throttle my site's API users?

Posted by scotts on Stack Overflow See other posts from Stack Overflow or by scotts
Published on 2009-09-03T19:39:45Z Indexed on 2012/06/06 10:40 UTC
Read the original article Hit count: 259

Filed under:
|
|
|
|

The legitimate users of my site occasionally hammer the server with API requests that cause undesirable results. I want to institute a limit of no more than say one API call every 5 seconds or n calls per minute (haven't figured out the exact limit yet). I could obviously log every API call in a DB and do the calculation on every request to see if they're over the limit, but all this extra overhead on EVERY request would be defeating the purpose. What are other less resource-intensive methods I could use to institute a limit? I'm using PHP/Apache/Linux, for what it's worth.

© Stack Overflow or respective owner

Related posts about php

Related posts about linux