Implement a filter that records each count and checks if the limit is reached.
To make it cheaper: 1. You can uses a preliminary counter in Memcache (see Memcache API, look for increment). A cron task then transfers the Memcache count into the Datastore every few minutes... 2. Another approach (but more expensive) is to read+write each count in the Datastore. That approach would prevent you from losing a few counts in the case the app's Memcache is cleared by Google.. If you expect high contention use "sharded counters". 3. You can also combine the two approaches. 4. Check the API calls per account on each access. If you want if cheaper here - you can use a probabilstic decision (i. e. randomized - for instance, check each call with a probability of 25%; that should get you in the101-105% range - with about 1/4 of calls compared to checking each access). If you want it even cheaper combine that with a Memcache approach. Hope this helps... On Nov 24, 4:55 pm, sellfisch <sellfi...@gmail.com> wrote: > Hi, > > i am currently working on an internet service with its own api. Using app > engine for maximum scalability sounds pretty sweet to me. Our API limitates > the number of calls per account. How can that be implementet efficiently in > GAE? > > I am using the datastore right now, but as far as i can see, i am loosing a > lot of cpu hours in waiting for the datastore. Now i am thinking about > using the memcache or a file on the blobstore to count up the requests. > > It is acceptable if the quota is not calculated right in time (we dont care > if a user can uses 101-105% of hits quota until the service blocks > requests). > > Whats our experience, what is cheap to do? > > Regrads > sellfisch -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.