-
Notifications
You must be signed in to change notification settings - Fork 8k
Refactor SessionsResource for better memory usage and performance #45808
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
base: main
Are you sure you want to change the base?
Conversation
Closes keycloak#45727 Signed-off-by: Pedro Ruivo <[email protected]>
Signed-off-by: Pedro Ruivo <[email protected]>
|
Some results, with a database populated with 200,000 regular sessions, and invoking the endpoint
|
ahus1
left a comment
There was a problem hiding this 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.
...pa/src/main/java/org/keycloak/models/jpa/session/ImmutablePersistentClientSessionEntity.java
Show resolved
Hide resolved
server-spi/src/main/java/org/keycloak/models/UserSessionProvider.java
Outdated
Show resolved
Hide resolved
...infinispan/src/main/java/org/keycloak/models/sessions/infinispan/ImmutableClientSession.java
Outdated
Show resolved
Hide resolved
...infinispan/src/main/java/org/keycloak/models/sessions/infinispan/ImmutableClientSession.java
Outdated
Show resolved
Hide resolved
model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProvider.java
Outdated
Show resolved
Hide resolved
| * @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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]>
|
@ahus1, thank you. Please re-review when you have the time. |
Signed-off-by: Alexander Schwartz <[email protected]>
ahus1
left a comment
There was a problem hiding this 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.
|
@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. |
Closes #45727