Google app engine - what is the life cycle of a PersistenceManager?

What is the preferred way to use the GAE PersistenceManager datastore for a web application? GAE instructions are a bit ambiguous in this matter.

Can I create an instance of PersistenceManagerFactory for each RPC call, or use only one factory for all requests? I call PMF.get (). GetPersistenceManager (), or I call PMF.get (). GetPersistenceManagerProxy ()? Do I close PM after every RPC call or leave it open? What are you guys doing?

Also, I'm not sure how GAE handles the 30 second request limit. Is it even possible to refer to the same PM between requests?

+4
source share
1 answer

PMF is expensive to create, so only one for each application makes sense. And getting PM per request also makes sense, since it's not expensive. Actually, it depends on what you plan to do with objects between requests, whether you want to separate them, and then reconnect to the next request.

Utilization of GAE / J applications, obviously, leads to the fact that the new PMF postpones the delay, which is necessary for Google; there was a thread on their forum that looked at timings for initializing various things, and I suggested what they could do, besides their own, so that they invested a resource in this effort.

NTN

+4
source

Source: https://habr.com/ru/post/1299905/


All Articles