Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-3298

Removing userSessions is very slow when removing many sessions

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.0.Final
    • Fix Version/s: 3.3.0.CR1
    • Component/s: None
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Use Keycloak in a few nodes (my app runs 12 of them)
      Create 100k sessions (or maybe less than that is enough)
      Go to the Sessions page in the admin console
      Click on Log out all and expect a high delay and an exception.

      Show
      Use Keycloak in a few nodes (my app runs 12 of them) Create 100k sessions (or maybe less than that is enough) Go to the Sessions page in the admin console Click on Log out all and expect a high delay and an exception.
    • QE Status:
      VERIFIED

      Description

      As discussed on the mailing list:

      I have this issue with my current configuration on Keycloak 2.0.0 where after creating more than 100k sessions (or much less than that, but I don't know the exact number), when I try to log out all of them from the admin console I got an UI error after some seconds and the exception at the end of my email. The process does not finish as expected and the sessions are still there.

      Marek said:
      It seems that bulk removal of userSessions is not very effective. It loads all the sessions locally from the remote nodes and then remove them one by one https://github.com/keycloak/keycloak/blob/master/model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java#L286-290 . Hopefully infinispan has a way that you will trigger task for "visit" sessions, which should be removed. Then you will directly remove the sessions on the node, where they live, in single step.

      Also the Sessions page loads really slow with 100k sessions.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mposolda Marek Posolda
                  Reporter:
                  fabriciomione Fabricio Milone
                  Tester:
                  Vlasta Ramik
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: