0

For my case, this is error is caused because my my app is taking a long time to send the response. I just want to know what parameters should I add to my app.yaml file so that the deadlinechanges from 30 sec to something like 120 sec.
My app.yaml code

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT app:app

runtime_config:
    python_version: 3

resources:
    cpu: 4
    memory_gb: 8
Debdut Goswami
  • 1,301
  • 12
  • 28

1 Answers1

0

According to official documentation, App Engine Standard is optimized for applications with short-lived requests, a few hundred milliseconds.

However a request can take as long as 60 seconds to respond. After this time period the request handler will be interupted.

How Requests are Handled.

An app that doesn't will not scale well with App Engine's infrastructure.

I would recomend to use Google Stackdriver Trace to find the reasons why your application requests execution time is greater than 60 seconds.

EDIT

The answer provided was for Google App Engine Standard. I noticed that you are using Google App Engine Flex. The 60 seconds limit does not apply to Google App Engine Flex because

Application instances run within Docker containers on Compute Engine virtual machines (VM).

App Engine Flex is recommended for:

Applications that receive consistent traffic, experience regular traffic fluctuations, or meet the parameters for scaling up and down gradually.

Choosing an App Engine environment

The 30 seconds error timeout might be a gunicorn server timeout.

Change your app.yaml, adding -t 120 (timeout 120 seconds):

      runtime: python
      env: flex 
      entrypoint: gunicorn -t 120 -b :$PORT main:app

Here you can find a related SO question link.

Community
  • 1
  • 1
marian.vladoi
  • 7,663
  • 1
  • 15
  • 29
  • I have checked the logs. The response is taking a lot more time depending on the user entry. Apparently, I am scraping a website in my back-end, so depending on the user input, multiple such pages are getting scraped. I can not reduce my scraping time any further. First, my app is taking somewhat 45 sec for response, but my app show 502 error at around 30 sec. I just want to know is there any way of increasing the time allowed by App Engine? – Debdut Goswami Dec 20 '19 at 09:53