Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-24276

The automatic use of documents/rights in the async context can use a lot of memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 10.10-rc-1
    • Rendering - Async
    • Unknown

    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 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).

      In terms of scale, I have the following example: a script loading and saving 130 000 documents produces in memory a 170MB async context. XWIKI-24280 is also probably making those numbers worst that they should be.

      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 (but might break some use cases)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tmortagne Thomas Mortagne
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: