Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google app engine excessive small datastore operations

I'm having some trouble with the google app engine datastore. Ever since the new pricing model was introduced, the cost of running my app has increased massively.

The culprit appears to be "Datastore small operations", which come in at more than 20 Million ops per day!

Has anyone had this problem, I don't think I'm doing an excessive amount of key lookups, and I only have 5000 users, with roughly 10 - 20 requests per minute.

Thanks in advance!

Edit

Ok got some stats, these are after abut 3 hours. Here is what I am seeing in my dashboard, in the billing section: Appengine dashboard - billing

And here are some of the stats:

Stats

Obviously there are quite a lot of calls to datastore.get. I am starting to think that it is my design that is causing the problem. Those gets correspond to accounts. Every user has an account, but an account can be one of two types, for this I use composition. So each account entity has a link to its sub account entity. As a result when I do a search for nearby users it involves fetching the accounts using the query, and then doing a get on each account to get its sub account. The top request in the stats picture is a call that gets 100 accounts, and then has to do a get on each one. I would have thought that this was a very light query, but I guess not. And I am still confused by the number of datastore small ops being recorded in my dashboard.

like image 975
Theblacknight Avatar asked Nov 11 '11 19:11

Theblacknight


People also ask

What is the data store used by Google App Engine?

Google App Engine (GAE) is a platform-as-a-service product that provides web app developers and enterprises with access to Google's scalable hosting and tier 1 internet service. GAE requires that applications be written in Java or Python, store data in Google Bigtable and use the Google query language.

How can you reduce latency when adding expenses to Cloud Datastore?

How can you reduce latency when adding expenses to Cloud Datastore? Use a batch operation to add multiple entities in one request. An employee can have multiple expense exports and each expense report can have multiple expenses.

Which of the following is the new version of Google Cloud Datastore that has certain improvements over the existing one?

Firestore is the newest version of Datastore and introduces several improvements over Datastore. Existing Datastore users can access these improvements by creating a new Firestore in Datastore mode database instance.


1 Answers

Definitely use appstats as Drew suggests; regardless of what library you're using, it will tell you what operations your handlers are doing. The most likely culprits are keys-only queries and count operations.

like image 198
Nick Johnson Avatar answered Nov 09 '22 05:11

Nick Johnson