Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pruivo
Copy link
Member

@pruivo pruivo commented Jan 27, 2026

Closes #45727

@ahus1 ahus1 self-assigned this Jan 28, 2026
@pruivo
Copy link
Member Author

pruivo commented Jan 28, 2026

Some results, with a database populated with 200,000 regular sessions, and invoking the endpoint /admin/realms/realm-0/ui-ext/sessions?first=0&max=101&type=ALL&search=X

  • Keycloak 26.5 took 1.9 minutes
  • This PR took 2.4 seconds

@pruivo pruivo marked this pull request as ready for review January 28, 2026 12:59
@pruivo pruivo requested review from a team as code owners January 28, 2026 12:59
Copy link
Contributor

@ahus1 ahus1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, great work!

See below for some comments. Please add a release notes "notable change" that describes the SPI changes. As they are internal SPI, they are not breaking, still people should be aware of it.

See below for my note to review which methods should be considered for deprecation.

* @param offline If {@code true}, it streams the offline sessions, otherwise the regular sessions.
* @return A {@link Stream} for all the sessions in the realm.
*/
Stream<UserSessionModel> readOnlyUserSessionStream(RealmModel realm, boolean offline);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can some of the other methods be deprecated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have a follow-up issue to check them. #45823

Signed-off-by: Pedro Ruivo <[email protected]>
@pruivo
Copy link
Member Author

pruivo commented Jan 28, 2026

@ahus1, thank you. Please re-review when you have the time.

@pruivo pruivo requested a review from ahus1 January 28, 2026 14:48
Signed-off-by: Alexander Schwartz <[email protected]>
Copy link
Contributor

@ahus1 ahus1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pruivo - thank you for the review, looks good to me.

I only too late saw that you opened a follow-up issue for the deprecation, and I pushed one more commit.
I hope there is nothing wrong with that PR, and we keep the task of any other deprecation to the other task.

Please have a look at my latest changes, and then it should be good to me merged.

@ahus1
Copy link
Contributor

ahus1 commented Jan 28, 2026

@pruivo - there seems to be a flaky (?) test in this run: https://github.com/keycloak/keycloak/actions/runs/21450898156/job/61779616007?pr=45808

What surprises me is a HSEARCH000041 "Index directory does not exist, creating" info message that is issues while the tests have already started running. Is that maybe the cause of the errors? Could Keycloak wait for those indexes to be created?

This run also failed, not sure yet why it failed: https://github.com/keycloak/keycloak/actions/runs/21450898156/job/61779616011?pr=45808

I hope it is due to my changes ... still I need to take a break now until tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor SessionsResource for better memory usage and performance

2 participants