appstats analysis - Same request - Too much difference in serving time

132 views
Skip to first unread message

Rajesh Gupta

unread,
Aug 3, 2015, 10:17:00 PM8/3/15
to Google App Engine
Attached are the two screen shots showing the appstats
- same request
- same appengine instance
- same user

The first request took 2914 ms, and the second request takes only 1032ms
As you can see in the attached images, 

3rd line datastore_v3.RunQuery, difference of 9ms 
5th line memcache.get, difference of 73ms
6th line memcache.get, differnce 73ms

Through out the request, there is lot of time difference in the datastore and memcache calls, between the two requests.

What can it done to make consistent.

Rajesh
Accounting/Inventory/Orders on Google Cloud Platform and Mobile
Screenshot 2914ms.png
Screenshot 1032ms.png

Nick (Cloud Platform Support)

unread,
Aug 6, 2015, 6:37:31 PM8/6/15
to Google App Engine
Hi Rajesh,

Results like these are generally to be expected (at least in terms of the variance of latencies).

The trade-off you make with Cloud services is that while you get the scalability and pwoer of a data-center-wide RAM cache or schemaless Datastore, you also get the variability of such data structures (and in the case of Memcache, the volatility of a distributed RAM data structure where the resources are shared within the data center).

Without seeing your code, nobody can offer you a solution. There are many factors which could be optimized in theory. It looks, for one thing, that you're making a lot of calls. Have you considered somehow batching or grouping these queries into single operations?

Best wishes,

Nick
Message has been deleted

Rajesh Gupta

unread,
Aug 10, 2015, 12:25:54 AM8/10/15
to Google App Engine
Dear Nick
I have noticed that this latency difference happens for a request with a new instance.  The same request will have considerable less latency for the second time for the same instance.  

I will also consider redoing some code and do some batch calls as suggested by you.

But,I have made this observation many times and easily I can produce the stats.  Why for a new instance and for the first request, the latencies are large.?   

Nick (Cloud Platform Support)

unread,
Aug 10, 2015, 7:39:33 PM8/10/15
to Google App Engine
Hi Rajesh,

The first request vs. second request differences can be explained by taking a look at the functioning of Objectify, which it appears you're using.

In Objectify, the library maintains a small in-memory cache which allows it to serve requests and update entities with less latency. This might be what you're seeing depending on the time-frame between first and second requests, and the data being different or similar between the requests. You can read about Objectify caching here.

I hope this proves to be a useful resource for you. Let me know if you have any more questions after this and I'll be glad to assist.

Best wishes,

Nick

Jeff Schnitzer

unread,
Aug 10, 2015, 9:11:08 PM8/10/15
to Google App Engine
This is not quite accurate. Objectify's session cache spans only a single request; there is no instance cache shared across requests (other than memcache).

However, if that first request includes the one-time entity class registration that Objectify requires, that could easily explain extra time spent.

Jeff

--
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-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/9a7e37e3-5eaa-4bb5-b058-d5f5888fc9b8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Rajesh Gupta

unread,
Aug 10, 2015, 10:59:12 PM8/10/15
to google-a...@googlegroups.com
Thanks Jeff and Nick.

The entities are register in the ServletContextListener, and hence the first request and second request are the same.



For more options, visit https://groups.google.com/d/optout.



--

Nick (Cloud Platform Support)

unread,
Aug 13, 2015, 7:30:39 PM8/13/15
to Google App Engine
Hi Rajesh,

Do you think it might be possible for you to duplicate your app, cut out unnecessary functionality, and post this to a public issue tracker issue from which we could take a deeper look at this and possibly determine why it's behaving in that manner? This would be up to you if you chose to do so, but realize that our troubleshooting abilities are limited when handled in the format of a Groups thread.

Best wishes,

Nick
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

Rajesh Gupta

unread,
Nov 24, 2015, 8:49:27 AM11/24/15
to google-a...@googlegroups.com
Hello Nick,
It is difficult to cut out the app and post the code on the issue tracker.

I can put lot of logs in the code.  I will give the details of the app-id, and will show you the logs.  You can also see the appstats for the same requests.  The datastore get() and query() take longer time.

If the request is served with the fresh instance, it takes longer.  

It can also be tried, by shutting all the instances, and issuing the same request.  It takes longer.  

Rajesh
Accounting/Inventory/Orders on Google Cloud Platform and Mobile


To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.

--
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-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.



--
Rajesh
Accounting/Inventory/Orders on Google Cloud Platform and Mobile

--
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-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Nick (Cloud Platform Support)

unread,
Nov 24, 2015, 1:05:05 PM11/24/15
to Google App Engine
Hey Rajesh,

Whatever you do when you post your issue tracker issue, make sure that you include enough information that can allow somebody to either observe the issue on your app, or reproduce the issue independently, and be sure to respond to any replies on the thread asking for extra needed information as necessary. Best of luck!
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.



--
Rajesh
Accounting/Inventory/Orders on Google Cloud Platform and Mobile

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages