Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-123084 POC obtain user segments only when it is needed #505

Closed

Conversation

cgoncas
Copy link
Collaborator

@cgoncas cgoncas commented Nov 4, 2020

Motivation

The method getSegmentsEntryIds is called in every request that receives the Liferay server. It decreases the performance of the server.

Proposed solution

Move the code from the SegmentsEntryPreAcction to where it is used.

  1. Create a utility class SegmentEntryRetriever (maybe we need to rename it), that returns the SegmentsEntryIds of a given group, user and context (LPS-123084 Create utility class SegmentsEntryRetriever (that encapsulates common code for obtaining segments) #640).
  2. Create a new method getSegmentsExperienceIds that doesn't contain the segmentEnryIds (LPS-123084 Add a new method getSegmentsExperienceIds, without the parameter segmentsEntryIds. #659).
  3. Call SegmentEntryRetriever directly where SegmentsWebKeys.SEGMENTS_ENTRY_IDS is used (LPS-123084 Obtain user segments only when it is needed #665).
  4. Call the new method getSegmentsExperienceIds so we don't need to get the segmentEntryIds when the page has NOT experience (LPS-123084 Calculate the segments only when there are experiences associated with the layout. #686).

Performance Results

With this fix, the results are almost as good as not use segmentation.

You can check the full results in this document.

Portal Version Version Session Count Mean Time of Login Portal CPU Usage (%) DB CPU Usage (%) Session count changes(%)
BaseLine 2b20ab5 38428 269 96,96,96 0,0,0 -
Test 21 Segment(100 segments) 38203 275 96,96,96 0,0,0 -0.5855105652

@liferay-continuous-integration

To conserve resources, the PR Tester does not automatically run for every pull.

If your code changes were already tested in another pull, reference that pull in this pull so the test results can be analyzed.

If your pull was never tested, comment "ci:test" to run the PR Tester for this pull.

@manoelcyreno
Copy link

ci:test:tango

@manoelcyreno
Copy link

ci:test:echo

@liferay-continuous-integration

@liferay-continuous-integration

❌ ci:test:echo - 6 out of 20 jobs passed in 2 hours 23 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 012adf4b2836179a5478bf04b5337955917fccb8

Copied in Private Modules Branch:

Branch Name: master-private
Branch GIT ID: 0ff04d9f73a4643abdd2b335581feef26b985b8a

ci:test:echo - 6 out of 20 jobs PASSED

14 Failed Jobs:

6 Successful Jobs:
For more details click here.

Failures unique to this pull:

  1. test-portal-acceptance-pullrequest-batch(master)/functional-tomcat90-mysql57-jdk8/11
    Job Results:

    64 Tests Passed.
    4 Tests Failed.

    Click here for more failures.
  2. ...

@liferay-continuous-integration

@manoelcyreno
Copy link

@david-gutierrez-mesa can you take a look, if the Echo failures have something related to the PR?

@Tim-Cao
Copy link

Tim-Cao commented Dec 17, 2020

ci:test:echo

@liferay-continuous-integration

❌ ci:test:echo - 7 out of 20 jobs passed in 2 hours 52 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 6db1295ed2ab7bbf5d05a27108a80c399369c249

Copied in Private Modules Branch:

Branch Name: master-private
Branch GIT ID: 0ff04d9f73a4643abdd2b335581feef26b985b8a

ci:test:echo - 7 out of 20 jobs PASSED

13 Failed Jobs:

7 Successful Jobs:
For more details click here.

Failures unique to this pull:

  1. ...

@liferay-continuous-integration

@Tim-Cao
Copy link

Tim-Cao commented Dec 18, 2020

Hi @cgoncas and @david-gutierrez-mesa,
According to analysis results of ci:test:echo, the failure cases are not related to this PR. Those are known failure in our team.
ci:test:echo(Run in PR)

@cgoncas
Copy link
Collaborator Author

cgoncas commented Dec 29, 2020

Closing this PR, since this solution is already merged into master

@cgoncas cgoncas closed this Dec 29, 2020
@cgoncas cgoncas deleted the MOVE_CODE_WHERE_IT_IS_USED branch January 28, 2021 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment