Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
17.10.0
-
Unknown
-
Description
XWikiDocument#getPreparedXDOM caches the prepared content of a document, but when there is no usable prepared content yet, each thread that asks for it runs the whole preparation of the content on its own. This happens when a document is loaded in the document cache or its content changes, and for each request sending Cache-Control: no-cache.
The preparation of the content can be expensive: it includes, for example, the syntax highlighting of all the code macros of the page, also inside wiki macros. When many requests for such a page arrive at the same time (for example from crawlers), they all prepare the same content in parallel and compete for the CPU, so each of them takes longer and more requests pile up. In production, this was observed as a burst of requests taking up to more than 15 minutes, with almost all of their time spent preparing the content.
Instead, a thread that needs the prepared content while another thread is preparing it should wait for that preparation and reuse its result when the cache control allows it, that is when the preparation started after the start of its request.
Attachments
Issue Links
- is related to
-
XWIKI-25417 A concurrent call to getXDOM can replace the prepared content of a document with its unprepared content
-
- Open
-
- relates to
-
XWIKI-22215 XWikiDocument#getPreparedXDOM can run the preparation on the same XDOM instance in several threads
-
- Closed
-
-
XWIKI-23250 Ignore cache-control requests in some cases
-
- Open
-
-
XWIKI-25413 The code macro syntax highlighting is slow and scales badly when several pages are rendered in parallel
-
- Open
-