I have an app that's sort of like a to-do application. Any given user would 
have "Tasks" that are pending at any given time. The number of tasks 
pending for a user can range from 0 to 5000. I need to fetch the pending 
tasks (or at least a small batch) for each user when they load the page.

How do I make sense of these latencies:

*Scenario 1:*

User A: Has 2500 pending tasks. The query limit is 500 and results fetched 
on the first request are obviously 500. Time taken: 5767 milliseconds (5.7 
seconds).

User B: Has 2 pending tasks. The query limit is 500 and results fetched on 
the first request are obviously 2. Time taken: 7124 milliseconds (7.1 
seconds).

*Scenario 2:*

User A: Has 2500 pending tasks. The query limit is 10 and results fetched 
on the first request are obviously 10. Time taken: ~400 milliseconds (1/2 
second).

User B: Has 2 pending tasks. The query limit is 10 and results fetched on 
the first request are obviously 2. Time taken: 5-6 seconds.
I thought I could speed up the query if I knew what the limit would be for 
users with fewer than 500. So there is a user with 551 tasks. Here's what 
happened:

*Scenario 3:*

User A: Has 2500 pending tasks. The query limit is 551 and results fetched 
on the first request are obviously 551. Time taken: 6251 milliseconds (6 
seconds).

User B: Has 551 pending tasks. The query limit is 551 and results fetched 
on the first request are obviously 551. Time taken: 13053 milliseconds (13 
seconds).

I can't find a pattern here. How do I optimize my queries so that users 
with less data can get their pages loaded quickly.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/20d18d07-90c2-4c4b-8b47-2316d425c152%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to