If I build a Spring app on App Engine, will it use multithreading by default or can it be configured to?
According to the latest App Engine news, Java apps can minimize the number of instance hours they use by enabling multi-threading - which will allow them to use more resources per instance-hour.
If I build a Spring app on App Engine, will it use multithreading by default to optimize its resource use?
Or is there so开发者_运维技巧mething I need to do to configure it to take advantage of this App Engine feature?
Servlet multithreading on AppEngine is off by default. You can simply enable it by adding a <threadsafe>true</threadsafe>
element to appengine-web.xml
.
In this case your servlets must be thread safe: basically this means that they should not have internal state (fields) or access to the state data must be synchronized.
About Spring: I'm not familiar with Spring internals, so I could not say if it's thread safe.
精彩评论