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

On Mon, Aug 10, 2015 at 4:39 PM, Nick (Cloud Platform Support) <
pay...@google.com> wrote:

> 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
> <https://github.com/objectify/objectify/wiki/Caching>.
>
> 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
>
> On Monday, August 10, 2015 at 12:25:54 AM UTC-4, Rajesh Gupta wrote:
>>
>> 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.?
>>
>> On Friday, August 7, 2015 at 4:07:31 AM UTC+5:30, Nick (Cloud Platform
>> Support) wrote:
>>>
>>> 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
>>>
>>> On Monday, August 3, 2015 at 10:17:00 PM UTC-4, Rajesh Gupta wrote:
>>>>
>>>> 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
>>>> *www.VeersoftSolutions.com <http://www.veersoftsolutions.com/>*
>>>> *www.AccountingGuru.net <http://www.accountingguru.net/>*
>>>> *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+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@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
> <https://groups.google.com/d/msgid/google-appengine/9a7e37e3-5eaa-4bb5-b058-d5f5888fc9b8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CADK-0uhH86bpSbsnaZo71E0fn6w1uL%3DWHmMmOfdcPJ8EqvFoZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to