Keycloak auth manager causes long loading times for the webserver #56502
Replies: 3 comments
-
cc @vincbeck WDYT? |
Beta Was this translation helpful? Give feedback.
-
Some additional context from what I've already looked into and thought about: Here Is the function that is called for every singel-resource authentication request, and it creates a request to keycloak every time. The batch function does not seem to be used much. I tried something like this, which seemed to solve the loading time issue, but it kinda ignores the
|
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for the feedback and all the details, that's very helpful. There is one open PR to address the same issue I think: #56433. I plan to look at that PR this week. It seems there is indeed a performance issue with Keycloak and I'll fix it anytime soon. In the meantime, if you can look at the PR I just linked and provide feedbacks whether you think it would resolve your issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
After configuring the Keycloak auth manager (from the keycloak providers package) in our helm-based deployment, i realized that the loading times of the website were incredibly high.
I then did some digging through the logs, and found that the auth manager seems to send a new request to keycloak for every kind of permission that was needed, causing between 2 and 4 requests per second for a single user.
Since this seemed too much for me, i looked through the code of the auth manager and found that indeed, unless a batch_permission was checked, it would create a new request every time.
Is there a specific reason for this, instead of requesting and caching the whole set of permissions at once? The python-keycloak library offers functions for retrieving all permissions, so even short-lived caches would reduce the amount of requests to keycloak significantly.
I don't know if this is considered a bug, so i created this discussion thread. I'm also willing to create an issue instead, but wanted to get a second opinion first.
Beta Was this translation helpful? Give feedback.
All reactions