I have got doubts considering the lifetime cycle of webapps using AppEngine. Let's consider the following situation: I would like the servlet to be super peer in my p2p network, which serves information about currently connected users, and all the other details that are useful while using p2p protocol.
I have decided to store these data using Datastore Java API. When the request comes to the app, the data is retrieved from the database and sent to the user. Simple. Here is the thing - the data retrieval seems to be somewhat redundant. I wonder if it is possible to retrieve the data once, when the app starts and then send it to the users.
I am aware of the 60 seconds request and response limit, and based on this topic Google App Engine Instance Life Cycle , I guess that every user request will create another instance of servlet, and all of the data will have to be retrieved everytime the user sends a request. Am I right? Is there something that can be done to get rid of redundant database access? How about using Backend provided by Google?
Thanks in advance!
A new instance is NOT started for every request.
Instances are started when GAE believes it need more computing power to serve requests.
You can never know which instance will serve a request.
Backends are fixed instances (= you configure how many are running) so they are a good fit to hold shared data. Keep in mind: backends are not permanent storage, they can be restarted anytime (in my experience this happens once a day). So you need to save your data
You can use memcache (=volatile, but fast and cheap) to hold shared data and datastore as a fallback (=reliable, but slower and expensive).