0
votes

We are using Google App Engine with Datastore and Objectify. In our local machine it's taking 1 second to do a query while in the cloud it's taking arround 20 seconds. The server location is in europe-west and I am in Spain so I don't think this is the issue.

The query we are performing is just retrieving data with just 1 filter:

final CityEntity cityEntity = new CityEntity();
cityEntity.setId(1);
ofy().load().type(Person.class).filter("city =", cityEntity).list();
1

1 Answers

0
votes

In the datastore, queries scale with the size of the result set. How many people are in the city? If large, the query will not only be slow, you'll quickly hit the limits of RAM.

Depending on what you are trying to do, you may need to take a different approach. For example, you could perform a keys-only query, convert the result to tasks, and enqueue a task for each person. That will probably work up to hundreds of thousands, maybe low millions before you hit the 10m deadline of a task/cron. For larger quantities, you probably want some form of map/reduce.