Skip to content

[FIX] Tiki 18 Only version of elastic: Cache field mappings to save connections to the ES server, can reduce calls from dozens to 3 or 4 - speeds up one medium complex plugin list page from 17s to 4s load time.

This is an alternate approach to the fix that @jonnybradley did on the master branch, because the way that mappings are organized in Tiki 18 are completely different from trunk, it was not possible to use the other fix here. The structure of mappings in Tiki 18 are something like the following which made it impossible to lookup a specific item efficiently.

[indexname] -> [mappings] -> [user] -> some info -> [group]-> some info -> ... -> [some info]

and so the first key [user] only contained user and user tracker info.

However the slowdown overcome on a page with many LIST plugins for example by this fix can be extremely significant, and so I felt a fix in Tiki 18 is warranted too as it's LTS and going to be around for a while. For example, A page that took 15 seconds to load takes now only 5 seconds.

I have left Jonny's fix in the master branch alone as my test on a middle sized site shows that one performs better (example, on one page that loads about 3 seconds using this method loaded only in 2 using Jonny's method). However, I can see that if a site has many fields in total, say over a couple of hundred, then it might be slower using Jonny's method - I'm not sure. When the time comes we can always make a pref to be able to switch the method of caching mappings if it works. Moreover, like Jonny implied, it might be possible in future to cache all the mappings locally through cachelib or some other further improvement too.

Edited by Nelson Ko

Merge request reports