8000 KEYCLOAK-19783 Cached user's session ids for faster user sessions retrieval by gideonray · Pull Request #8715 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

KEYCLOAK-19783 Cached user's session ids for faster user sessions retrieval - #8715

Closed
gideonray wants to merge 1 commit into
keycloak:mainfrom
gideonray:KEYCLOAK-19783
Closed

gideonray wants to merge 1 commit into
keycloak:mainfrom
gideonray:KEYCLOAK-19783

Conversation

@gideonray
Copy link
Copy Markdown

I noticed that the API to retrieve user sessions is getting slower as the number of active user sessions increase. After looking at InfinispanUserSessionProvider, I realized that retrieving sessions for a user ends up iterating all the sessions from the "sessions" cache.

To address this, I'm proposing to cache the user's session ids and use that cache to retrieve all the sessions of a user. The cache gets updated by listening to events from "sessions" cache. Basically, an entry for a user will be added or updated whenever a session is created or removed for a particular user.

@stianst
stianst requested a review from hmlnarik November 8, 2021 09:08
@stianst stianst left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is something we want to improve in the old store, and rather would want to make sure we solve this issue in the new store. @hmlnarik wdyt?

@gideonray
Copy link
Copy Markdown
Author

@stianst , didn't know there's a new store, but that would be perfect if issue is fixed in the new store.

@stianst
stianst commented Nov 10, 2021
Copy link
Copy Markdown
Contributor

I'm going to close this as it's not a good approach to create another cache for this purpose. It'll use additional memory, and will also get out of sync I would imagine. Infinispan already has supported for indexing and querying, which should be used for cases like this.

@stianst stianst closed this Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0