Doing a global count of an object type (like Users), best practice?
- by user246114
Hi,
I know keeping global counters is frowned upon in app engine. I am interested in getting some stats though, like once every 24 hours. For example, I'd like to count the number of User objects in the system once every 24 hours.
So how do we do this? Do we simply keep a set of admin tool functions which do something like:
SELECT FROM com.me.project.server.User;
and just see what the size of the returned List is? This is kind of a bummer because the datastore would have to deserialize every single User instance to create the returned list, right?
I could optimize this possibly by asking for only the keys to be returned, so the whole User object doesn't have to be deserialized.
Then again, a global counter for # of users probably would create too much contention, because there probably won't be hundreds of signups a minute for the service I'm creating.
How should we go about doing this? Getting my total number of users once a day is probably a pretty typical operation?
Thank you