we have been running benchmarks of keycloak 9.0.0 (docker cluster + separate infinispan + mysql database) and we were seeing a lot of deadlocks during mass registration (~10 threads concurrently registering ~10k-100k users on a single realm)
We found out that it was caused by full scans performed on FED_USER_ATTRIBUTE, locking the table and preventing other threads to perform inserts.
Adding this index causes the issue to disappear:
(indexing `STORAGE_PROVIDER_ID` allow the optimizer to not perform a full scan)
We have built a customized container based on jboss/keycloak:9.0.0, adding a custom user-federation module, jgroups settings for environments where multicast isn't available, and lots of other changes performed using the CLI.
Where should we look to insert a liquibase migration to create/update this index ? possibly without having to fork or recompile keycloak ?
Thanks in advance