Affects Version/s: Master
Fix Version/s: Master
Sprint:TANGO | #45 DEV | Sep11-Sep25, TANGO | #46 DEV | Sep25-Oct09, TANGO | #47 DEV | Oct09-Oct23
What problem did the customer find?:The customer configured 75 user segments and they detected throughput issues in their testing before the go-live.
What do you think is the root cause? (if known):Lack of cache system when querying Elasticsearch, we are retrieving same data again and again.
There were no throughput testing during QA-testing so this problem wasn't detected at implementation time.
Proposed solution (if any):Add a cache to avoid continuously query Elasticsearch in the same way we do with the database or in the same way segmentation and personalization code does with Analytics cloud in AsahSegmentsEntryCache
Segmentation defined segments causes performance issues due to excesive Elasticsearch queries.
Every time a user clicks in a page, one Elasticsearch query is executed per each existing segment.
So in case you have 100 segments, 100 Elasticsearch queries will be executed every time an user clicks in the Liferay interface.
Some kind of cache should exist, retrieving data from Elasticsearch in case it is necessary.
Steps to reproduce
- Go to control panel => server administration => log traces and activate DEBUG traces for category com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter
- Create a new site
- Add two pages (page1 and page2) and publish them
- Create 4 "email address" segments and configure them with:
- email address contains domain-aa.com
- email address contains domain-bb.com
- email address contains domain-cc.com
- email address contains domain-dd.com
- Open a new browser (for example a incognito window or change from chrome to firefox) and navigate to the page1:
- Some Elasticsearch queries will be written to log file in a trace written by SearchSearchRequestExecutorImpl class.
- In the new browser move from page1 to page2 and vice-versa:
- : There aren't new queries written to the log file
- : Some Elasticsearch queries generated by SearchSearchRequestExecutorImpl will be written to the log file, even there were no change in the user information