[keycloak-dev] Support concurrent startup by more cluster nodes
Marek Posolda
mposolda at redhat.com
Mon Mar 7 05:03:55 EST 2016
Send PR with added support for $subject .
https://github.com/keycloak/keycloak/pull/2332 .
Few details:
- Added DBLockProvider, which handles acquire and release of DB lock.
When lock is acquired, the cluster node2 needs to wait until node1
release the lock
- The lock is acquired at startup for the migrating model (both model
specific and generic migration), importing realms and adding initial
admin user. So this can be done always just by one node at a time.
- The lock is implemented at DB level, so it works even if infinispan
cluster is not correctly configured. For the JPA, I've added
implementation, which is reusing liquibase DB locking with the bugfix,
which prevented builtin liquibase lock to work correctly. I've added
implementation for Mongo too.
- Added DBLockTest, which simulates 20 threads racing for acquire lock
concurrently. It's passing with all databases.
- Default timeout for acquire lock is 900 seconds and the time for lock
recheck is 2 seconds. So if node2 is not able to acquire lock within 900
seconds, it fails to start. There is possibility to change in
keycloak-server.json. Is 900 seconds too much? I was thinking about the
case when there is some large realm file importing at startup.
Marek
More information about the keycloak-dev
mailing list