Keycloak Java stream performance - many groups

Hi,
is there any possible way to get

  • a list of many groups (>2000) based on the name
  • from each of these groups, I need only the users of four subgroups (it is one user per subgroup or zero)

in a performant way. Currently the first request can cause a timeout at 3 min. The second one is at about 1 min.

e.g. (method name is getting refactored as it is missleading):

Thanks!