To ease management thank you to deal with only 1 topic per post (please post a separate post for you question on system parameters vs env variables and another one for details about hosting of your dev instances)
Business object API pooling is a standard mecanism that is used on the API enpoint when the system parameter USE_WEBSERVICES_OBJECTPOOL is set to yes.
By default it is set to no except for the non-authenticated public pseudo-user (which is the right configuration in most usual cases):
If you are using a technical authenticated user, you should also set it to
yes for him.
Other pool-related parameters allow you to do some fine tuning on the pool sizes:
These parameters can also be overriden on a per-user basis.
There is no reason not to use object pooling for APIs, especially if there are many concurrent calls, because it is what ensures good performances and isolation.
When using the standard business objects APIs or the mapped APIs, the polled objects are used by default.
If you implement a custom API (again, you only have to do this for very particular cases, not for basic CRUD on your business objects) you MUST ABSOLUTELY use the borrow/return pattern on your business objects in your code => it will use the pooled instances if enabled for the user calling the API or temporary isolated object instances if not (but this will have a significant impact on performances):
ObjectDB obj = null;
try {
// Borrow an API object instance from the pool
// (ZZZ this instance MUST be returned to the pool, see below)
obj = borrowAPIObject("MyObject");
// Do something with obj...
} catch (Exception e) {
// Handle exception
} finally {
// Return the API object instance to the pool
// (ZZZ this MUST be done in the finally block)
if (obj != null) returnAPIObject(obj);
}
Writing it any differently might cause tricky concurrent/synchronization/lifecycle/… issues and poor performances/memory leaks/etc. => NEVER useGrant.getObject() or Grant.getTmpObject() in a custom API code (unless you know exacly why you are doing it, but I don’t see why it would be a relevant thing to do)
Note : This pattern is the one given in the examples of the documentation