Official appengine documentation says that if we set threadsafe property to true in app.yaml then appengine will server concurrent requests.
Official link:
https://developers.google.com/appengine/docs/python/python27/newin27#Concurrent_Requests
-
Does it mean application will be faster (than 2.5) if we have threadsafe property to true? Official documentation/blog says so but i am looking for real world experiences.
-
At highlevel, How does it work internally? Will our application be initialized and spawn a new theread for each request?
You still only have one thread per request – you can’t spawn.
With threadsafe off, Appengine will only route one request to an instance. So if the number of requests per second times the time to handle a request approaches one, Appengine will spin up a new instance to handle them. This cost money. With threadsafe on, Appengine can route more than one request to an instance.
Whether this helps you or not depends on your app and your traffic:
The simple rule is switch threadsafe on unless your app is very processing-intensive (little API waiting).