views:

46

answers:

1

I'm looking for an efficient approach to rate-limiting request from Google App Engine to a third party service. The third party service rate limits requests on a per-account basis, and on the Google App Engine side, most of the work is carried out inside tasks. Token buckets are a great general algorithm here.

Q: what approach can be used to efficiently rate-limit requests on a per-account rather than per-service basis?

This should not involve setting up rates on GAE task queues as the number of requests per account and the number of accounts serviced will vary greatly. For performance reason I'm most interested in memcache-based (incr/decr?) ideas!

I think this boils down to memcache-based token bucket?

Thoughts?

A: 

I kept this project as a bookmark a while ago : http://code.google.com/p/gaedjango-ratelimitcache/

Not really an answer to your specific question but maybe it could help you get started.

Franck