2

On the standard env, we can set up "threadsafe: yes" in app.yaml to enable multiple threading for flask framework in python. Because Google will do anything for us.

For flexible env, we need to setup gunicorn to enable async-worker to make an application can process more than one request at one time.

But I wonder why the parameter "threadsafe: yes" does not work on flexible env and Google does not give us any error msgs when deploying the app engine.

app.yaml

runtime: python
env: flex
api_version: 1
threadsafe: yes  --> Is this working ?
service: myapp
entrypoint: gunicorn -b :$PORT main:app
Temu
  • 859
  • 4
  • 11
Eric Wei
  • 141
  • 7

1 Answers1

1

As long I have seen, it looks like you were able to set "threadsafe: yes" in flexible but it had no real effect, because in GAE Standard you would use com.google.appengine.api.ThreadManager and as you said Google will do anything for us but in GAE Flexible you have to manage your own threads with usual Java's class Thread or whatever you want to use.

So, there is no error message when deploying but also no effect in your code since from the beginning the safety of your threads is your concern.

Temu
  • 859
  • 4
  • 11
  • Most likely why there is no mentioning of such config in [Configuring your App with app.yaml](https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml) – Dan Cornilescu Jun 08 '18 at 12:56
  • IMO, I think because it could be considered deprecated. But if you rise an error for everyone with this option, people suddenly would not understand why there is an error and it is easier for everyone just ignore this line. – Temu Jul 23 '18 at 07:48