Request every 5 seconds

72 views
Skip to first unread message

Jake Mor

unread,
Mar 4, 2018, 1:58:10 PM3/4/18
to Google App Engine
Hi there,

I'm creating an api that is meant to be called by the client every 10 seconds. After around 10-15 requests ( a minute or so on the app ), the requests begin to time out.

Is there a setting I can change that would prevent this from happening?

Jake

Jordan (Cloud Platform Support)

unread,
Mar 4, 2018, 4:19:24 PM3/4/18
to Google App Engine
This sounds like it's simply the HTTP request deadline of the actual client request, and not your application code returning deadline exception errors. The client requests have a default deadline (specific to the library performing the HTTP request) that it will wait for your application to return a response. If your application is too busy/slow the client will give up waiting and time out.

There are a number of things which could be taking up response time (e.g network latency) so it is recommended to ensure your APIs always respond fast. This really comes down to your scaling settings in your app.yaml or appengine-web.xml, and your actual code. If requests are timing out that means either the requests are waiting too long for available CPU time on an available instance, or your code takes too long to finish and return a response. 

It is therefore recommended to use the default Automatic scaling settings as these are fine-tuned to provide proper request handling depending on your traffic patterns. You should also avoid slow code initialization times (e.g loading dynamic libraries), and offload all long-running non-client facing work to a different backend service as this will ensure your front-end client-facing instances are quick to start and always have available CPU to handle requests. 

Of course you can always increase the client-side request deadline, but this is not always an available option (e.g if the client requests are not in your control).  

- Note that Google Groups is for general product discussions and not for technical support. If you require further technical support with serving your requests it is recommended to post detailed questions to Stack Overflow using a supported Cloud tag. 

Attila-Mihaly Balazs

unread,
Mar 5, 2018, 2:34:01 PM3/5/18
to Google App Engine
A bit off topic, but something I noticed in the last couple of days: the G employees monitoring this forum started providing real answers to the questions rather than the templated "go ask it on Stack Overflow".

I just wanted to say: this is much nicer.

Thank you all!
Attila
Reply all
Reply to author
Forward
0 new messages