Search code examples
keycloakkeycloak-services

Long user upload procedure in Keycloak (REST)


Asking for your help. We start docker image stand-alone Keycloak in openshift. We add new users using REST. But everything works very slowly. For 240000 users the uploads takes 24 hours.

  1. Has anyone come across this?
  2. How do you add and update users?

Our server: CPU 4 4 GB. Our version of keyclock 7.3.1.GA.

The connection is constantly breaking and we are forced to send user packages


Solution

  • Based on key cloak, the following actions were performed:

    CREATE EXTENSION pg_trgm;
    
    CREATE INDEX in_user_entity_001
         ON user_entity USING GIST (lower (username) gist_trgm_ops);
    

    Explanations:

    The pg_trgm extension is included in the set of plugins supplied with PostgreSQL and is supported by PostgreSQL developers (https://www.postgresql.org/docs/11/pgtrgm.html).

    The created index is matched to a specific long query.