Cache API.getSegmentMetadata better in Segment - Improve performance on every UI request #17944
Labels
c: Performance
For when we could improve the performance / speed of Matomo.
Regression
Indicates a feature used to work in a certain way but it no longer does even though it should.
Milestone
I have here a regular UI call, and it triggers more than 90
API.getSegmentMetadata
calls which then triggers calls to funnels, heatmaps, goals, ... That's a site with like 50 segments.This is executed here: https://github.com/matomo-org/matomo/blob/4.5.0-b1/core/Segment.php#L186-L194
It's cached in a property but we often create a new segment instance like
new Piwik/Segment()
. So the cache isn't really used and for every segment we create a new instance and fetch segment metadata over and over again.The goal of this issue is to have a cache be reused across segment instances. Meaning when a new segment instance is created, and we fetched this data previously, then it should reuse the cache from the other instance. The data may need to be cached per site and maybe other criteria.
This all can be quite slow.
The text was updated successfully, but these errors were encountered: