Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Get Keycloak's startup time below 4 seconds #46491

@ahus1

Description

@ahus1

Description

Keycloak starts up well below 10 seconds, when you run the "build" phase before, and only have the optimized startup.

Can we get this well below 4 seconds in those setups where the database was already initialized?

Some ideas:

  • Concurrent initialization of the Keycloak factories - see "Details" for a patch idea
  • Move ISPN serviceloader moved to build phase similar to org.keycloak.marshalling.Marshalling
  • CDS, or JDK25 AOT feature - didn't seem to make much of an impact for startup time for me

Value Proposition

  • If we can provide a fast startup of Keycloak, people would be more willing to accept an active/standby setup

Goals

  • Bring the startup (well) below 4 seconds
  • Focus on implementing smaller changes now, and identifying bigger changes for the future
  • It is OK to make fast for JDK25, while other JDKs show the same performance as before.

Non-Goals

  • Doing major refactorings for KC 26.6

Discussion

No response

Notes

Ideally we would use virtual threads here to avoid the cost of thread creation during startup, and limiting the parallelization to the number of CPU cores: parallelize_factory_startup.patch

Some things moved to be more eager so they initialize in parallel. This needs more love to make it work also on JDK17+JDK21 and possibly to avoid "synchronized".

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions