You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
/users/?max=100000 API request partial response with timeout #26884
I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
admin/api
Describe the bug
API Request for All Users fails to complete.
Regardless of attempts to increase CPU and RAM available, when requesting all users from the API we see increasingly chunky chunks of JSON content returned by the API, until ultimately we hit a timeout at 30 seconds where the response body is incomplete and thus the JSON invalid.
With briefRepresentation set to true the request completes in 2.5 seconds consistently.
We have an older version of Keycloak 15.1.1 which is able to satisfy the all users request consistently without timeout.
Version
22.0.3
Expected behavior
API request to /users/?max=100000 should complete successfully
Actual behavior
API request to /users/?max=100000 times out after 30seconds with a partial response
How to Reproduce?
It is not clear how to reproduce this issue as it may relate to the specific data we are managing.
Returning a non-brief representation of 100000 users is a very expensive operation, and would have a significant impact on a given node, so that is something I'd recommend not doing, and rather do pagination.
The default transaction timeout is 300 seconds, but can be configured with quarkus.transaction-manager.default-transaction-timeout. I would not recommend doing this though as it will apply to all requests.
We could probably introduce a supported way to set transaction timeouts, as well as ability to set it differently for login vs admin. See #26889.
However, as I mentioned initially fetching 100000 users is a very expensive operation, and I'd avoid doing that in the first place.
@stianst Thank you for your response. It is indeed a silly query that should be avoided if possible. Interestingly it does appear to have indicated a significant performance regression in that particular request between 15.1.1 and 22.0.3. Regards.
Not really a regression I think as there is now additional information added to the full user representation that causes it to be more expensive. If I don't remember incorrectly the default tx timeout has also changed since 15 (I might be wrong here though).
You could always do some benchmarking and compare the results, if they are very different then open another issue with the details and we can take a look.
Activity
stianst commentedon Feb 8, 2024
Returning a non-brief representation of
100000users is a very expensive operation, and would have a significant impact on a given node, so that is something I'd recommend not doing, and rather do pagination.The default transaction timeout is 300 seconds, but can be configured with
quarkus.transaction-manager.default-transaction-timeout. I would not recommend doing this though as it will apply to all requests.We could probably introduce a supported way to set transaction timeouts, as well as ability to set it differently for login vs admin. See #26889.
However, as I mentioned initially fetching
100000users is a very expensive operation, and I'd avoid doing that in the first place.richardjennings commentedon Feb 8, 2024
@stianst Thank you for your response. It is indeed a silly query that should be avoided if possible. Interestingly it does appear to have indicated a significant performance regression in that particular request between 15.1.1 and 22.0.3. Regards.
stianst commentedon Feb 8, 2024
Not really a regression I think as there is now additional information added to the full user representation that causes it to be more expensive. If I don't remember incorrectly the default tx timeout has also changed since 15 (I might be wrong here though).
You could always do some benchmarking and compare the results, if they are very different then open another issue with the details and we can take a look.
richardjennings commentedon Feb 8, 2024
@stianst That is fair and understood. The benchmark numbers for 35000 users are roughly:
15.1.1 10 seconds
22.0.3 > 300 seconds