When Solr is using Sentry server for authorization, it issues a lot of calls to getGroupsByRoles() function in DelegateSentryStore.
This function isn't very efficient - it walks over each role in the set, obtains role by name, get groups for each role, and collects all group names into a set.
It may be possible to optimize it.
Also, in SentryGenericPolicyProcessor class method list_sentry_roles_by_group() would make N transactions to build the roles to set of groups map. Instead, make it to a single transaction. This will significantly speed up operation