Reputation: 56904
You can configure your Java GAE app with:
<threadsafe>true</threadsafe>
to allow your app instances to respond to HTTP requests concurrently for better performance. My question is: what are the coding ramifications of setting this property to true
? Do I need to make all my HTTP request handlers concurrent by making them implement Runnable
and have them utilize best concurrent programming practices?
If not, then what are the real benefits to utilizing this option? What's the difference between have 10 instances handle 10 different HTTP requests, or 1 parallelized instance handling 10 concurrent HTTP requests? In the end, don't I wind up getting billed all the same? Or am I missing something? Thanks in advance!
Upvotes: 1
Views: 352
Reputation: 31928
For starters with 10 instances cost you 10 times over a single instance (in instances hours), you should try to minimize your instance usage.
the main thing that you need to be aware of when using threadsafe is that you code will be, well, thread safe. don't access globals without locks (or try to avoid globals and locks all together).
Upvotes: 1