|
| Summary: |
The automatic use of documents /rights in the async context can use a lot of memory |
| Description: |
A use case which is typically going to use a lot of memory is an asynchronous execution which manipulate a huge number of documents: while manipulating a document one by one should not be a problem for the memory usually, in the case of an async execution each manipulated document will adds an entry in potentially add several entries the AsyncContext (XWiki#getDocument registers each document through AsyncContext#useEntity , and each right check, if the script API is used, will also be registered in the context ).
This automatic use has a lot of value for more common content in which the modification of one of the manipulated documents will automatically cause the cached result to be invalidated, for example. But this specific use (contrary to the use of web resources, for example) is generally pretty useless when caching is not enabled (except for a use case which would use the async context to identify all documents loaded in some content).
Some ideas to improve that: * have a maximum number of entries added to the async context (should probably be done anyway, as the context become quite unusable if are is too many entries) * introduce an API to control if some type of automatic use is enabled (but nobody will remember to use it) * disable the auto use when caching is disabled, depending on the type of use * introduce an API to control if (but might break some type of automatic use is enabled cases) |
|