This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-e5f370d6-5f60-45aa-8cb4-214e65f8e456 XWIKI-25414 Open

Concurrent requests for a document whose content isn't prepared yet all prepare it in parallel

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-d01901a5-6dc3-4568-9dfd-64edbde488be Michael Hamann created this issue on 19/Oct/26 16:47
 
Summary: Concurrent requests for a document whose content isn't prepared yet all prepare it in parallel
Issue Type: cid:jira-generated-image-avatar-e5f370d6-5f60-45aa-8cb4-214e65f8e456 Improvement
Affects Versions: 17.10.0
Assignee: Unassigned
Components: Old Core
Created: 19/Oct/26 16:47
Labels: performance
Priority: cid:jira-generated-image-static-major-3994d6a0-2274-4070-8aa2-b3d0d3c422bf Major
Reporter: Michael Hamann
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.

 
 

2 updates

 
cid:jira-generated-image-avatar-d01901a5-6dc3-4568-9dfd-64edbde488be Changes by Michael Hamann on 19/Oct/26 16:48
 
Fix Version: 18.10.0-rc-1
Assignee: Michael Hamann