Let me try to understand this correctly. There is a general set of best practices for being efficient with latencies - including trying to do batch requests wherever possible and storing data in memcache to avoid a lot of datastore queries and so on.
And then there is the question of what causes the latency spikes at the time of an instance starting up. We have observed specific spikes that occur only when a new instance is started. If I understand what you wrote correctly, you appear to be saying that if there are any external URL fetches, those calls will need to wait for the instance to startup before they can be handled - is that right? I am assuming any Image Service calls will be considered external server calls as well? A separate question is why the instance takes 30-60s to come up when our application startup times on a local machine or compute engine instance are in the order of 5-10s - what could be causing a 6x increase in startup times? Given we are on F4 instances, this sounds very strange. Thanks, Vidya On Tue, Oct 25, 2016 at 7:54 AM, 'Jordan (Cloud Platform Support)' via Google App Engine <[email protected]> wrote: > Resident Instances turning into Dynamic Instances to handle requests does > not effect the time required to start an instance (it is actually designed > to help it). When a new Idle Resident Instance is required, an > '/_ah/warmup' will be sent to your application. This will trigger the > creation of a new instance, and your code will begin to run. Therefore if > you are seeing high latency during instance startup, it is likely your code > that is the cause. > > You can use the Stackdriver Trace > <https://cloud.google.com/trace/docs/viewing-details> tool to sort > requests to your application over a period of time by highest latency. You > can then select the requests with the highest latency which will show you > the actual processes that ran during the request. If your code makes any > URL Fetch requests to other applications or servers, this forces your app > to wait for this external service to run, causing higher latency. Multiple > individual calls to other Google services such as the Datastore may also > cause latency. It is recommended to perform batch requests > <https://cloud.google.com/datastore/docs/concepts/entities#batch_operations> > to any Google service that supports it, in order to reduce the amount of > calls your application makes. By optimizing the time needed to execute your > code, the latency experienced by an incoming request will be reduced. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Google App Engine" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/google-appengine/0ZBLsyc51gk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > 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/d4baf583-826f-45b3-b139- > 1f47e699697e%40googlegroups.com > <https://groups.google.com/d/msgid/google-appengine/d4baf583-826f-45b3-b139-1f47e699697e%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 [email protected]. To post to this group, send email to [email protected]. 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/CADf2OP7eVBdg%3DfoNOpBfSU8dFdTV9BWS86bqGpM_jxpc%2Bb-fjw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
