google app engine slow and timing out

54 views
Skip to first unread message

Valerio M

unread,
May 17, 2018, 5:12:42 PM5/17/18
to Google App Engine
Hey,
I deployed an app yesterday. First time on GAE.
Not sure what's going on. The same app works on heroku.
The / loads extremely slowly. the main js file may load in  mins sometime. I modified the resources, # of instances, disabled health check... nothing. Always getting nginx 502

I tried plugging in to the docker instance and do a docker log but it seems that  only get the health check queries. at the moment i am running with 1 instance only, not sure why i do not see any request from docker.

I've also put a DEBUG variable in app.yaml, no good. The logs don't show any info. It's like as if my requests get lost behind the firewall (nginx?).

I am totally lost. All the debugging i've done following various tutorials is useless. Any help greatly appreciated.

regards,

Valerio


Valerio M

unread,
May 17, 2018, 5:25:12 PM5/17/18
to Google App Engine
forget to mention, it's node.js

Jordan (Cloud Platform Support)

unread,
May 18, 2018, 3:16:54 PM5/18/18
to Google App Engine
502 errors are often caused due to your application code being too busy to respond to nginx (the webserver that sits in front of your app that accepts and routes requests to and from your app). 

Nginx will return a 502 back to the load balancer which is returned back to the client if it is not able to communicate with your app. It is therefore recommended to ensure that you are properly coding for Node-js and that you are not blocking the Node-js Event Loop in order to always respond to nginx. 

If your application becomes too busy, and doesn't make time to accept and respond to health checks from nginx, nginx will stop communicating with your application and render it as unhealthy (and attempt to restart it, in turn stopping all requests it was handling). A busy application will also force new incoming requests to wait until previous requests have completed. This will cause increased latency for each new incoming request as they each wait in the pending queue for room on your instance.

You can use the App Engine Dashboard to view the resource usage, latency, and traffic patterns of your app, and pinpoint a timestamp with high latency. Then use the Stackdriver Log viewer to see what happened in your code at that timestamp. Just ensure you choose the 'nginx.error', 'nginx.request', 'stderr', and 'stdout' log options to see all incoming requests, errors, and debug output from your application. If a request receives a 502, this means it never made it to your application (since nginx couldn't reach it), and the logs will therefore be seen at the loadbalancer level (by selecting the 'Cloud HTTP Load Balancer' logs and not 'GAE Application' logs). 

- Note: Google Groups is reserved for general product discussions and not for technical support. For further technical support it is recommended to post your detailed questions to Stack Exchange using the supported Cloud tags. 


Valerio M

unread,
May 19, 2018, 12:09:36 PM5/19/18
to Google App Engine
Thanks for your answer,

In fact the issue was caused by the connection with mongodb, which however did not crash the app, but kept it working basically just for the /index.html request.
It's now solved

thanks you
Reply all
Reply to author
Forward
0 new messages