Priority: Normal
Current State: Being Worked On
Released In: 2.1.9
Target Release: minor
Applies To: Engine
Component:
Branches: Release02x01 master
The single most expensive thing in Foswiki is deserializing the disk format of a topic into memory while creating a Foswiki::Meta.
This issue has been spotted a long time ago as part of optimizing %SEARCH. Therefore a Foswiki::MetaCache has been implemented that
currently is a sub-component of Foswiki::Search. The current implementation of Foswiki::MetaCache is not ready for general use
to cache Foswiki::Meta objects, as documented in the comments of Foswiki::Meta::loadVersion(). This however is desperately needed,
ie for applicataions that make a lot of use of %QUERY and the like.
First, Foswiki::MetaCache should be moved out of Foswiki::Search and made a required component in the Foswiki object itself.
Second, the current implementation imho tries to cover several things at the same time:
- cache Foswiki::Meta topic objects
- cache revision info about this object
- cache access rights on this object
The latter is clearly related to the current user running the request.
Basically, we only need (1) here. By removing at least (3) the Foswiki::MetaCache becomes independent of the user. Theoretically
the meta cache could be kept intact accross several sessions, and not be constructed and deconstructed on every request.
To remove duties (2) and (3) from the meta cache all callers need to be investigated in how far this extra information is actually
needed. Note that within Foswiki::Search we still have the Foswiki::Search::InfoCache which probabl is the right place to
deal with caching information of that kind within search.
From an orbit perspective, the Foswiki::MetaCache should be sitting somewhat between Foswiki::Meta and Foswiki::Store. Any
access rights are actually checked once a topic object has been constructed ... which is worth caching on a different per user
per request level, but
not on a lower level like where Foswiki::MetaCache is supposed to live.
While caching Foswiki::Meta objects seems to be the next good thing to do to improve performance, this kind of caching somewhat
is in conflict with Foswiki::Meta's own way of lazily loading versions into memory. So once we've got a proper meta cache it might
be worth investigating in how far this optimization within Foswiki::Meta is actually still worth it. My guts say that it is yet
still it is important to keep an eye on this kind of caching per topic object.
--
MichaelDaum - 15 Aug 2023
MetaCache can be activated in Foswiki::Meta with an experimental flag. There are still unit tests failing if activated.
--
MichaelDaum - 05 Sep 2023
MetaCache has been activated by default now
knowing that there are still some unit tests failing.
--
MichaelDaum - 06 Sep 2023