Affects Version/s: None
Fix Version/s: None
Since we upgraded to Ranger 2.1.0 in our dev env, we've noticed that user list page in Ranger Admin UI is not showing (or it is very very slow - in the order of tens of minutes).
Looking at the commit history we found that the reason was commit f45054d1b9 which was meant as a performance improvement for
RANGER-2789. Our ranger usersync fetches users and groups from AD. Our tree is huge, here are some stats:
Looking at the commit f45054d1b9 what it meant to solve is perform a user lookup and fetching user info such as attributes and group membership in bulk, instead of doing it in a loop, one by one. In order to do that it provided couple of methods and also an override for searchXUsers in service/XUserService.java (before we used the parent method in service/XUserServiceBase.java).
The new searchXUsers method (which gets invoked when we call /service/xusers/users REST API, calls populateViewBeans (another new method). It calls the parent method populateViewBeans in XUserServiceBase.java which build a hashmap or users and calls an override of populateViewBeans with input hashmap
This in turns calls mapBaseAttributesToViewBeans, which calls daoManager.getXXPortalUser().findAllXPortalUser() and it pulls all users (no matter that we limit the users with a REST call to 25 by default)
That's one thing that hampers performance. However the biggest issue is this:
We call populateGroupList on the list of users (by default 25) but we call a new method that accepts a map as an input. Inside that method we call
Which in our case will pull all 366180 group to user membership mappings from x_group_users table.
Next we filter through the whole group list just to find all users who have memberships in those group (but we traverse the whole group membership list)
This is what happens when we open Ranger and go the User UI. We make a paginated request to view the first 25 users from the DB, but actually what ranger does is pulling all users from the DB and also traversing the whole group-to-user membership list.
When reverting the commit to go to the old behaviour things went back to normal. We understand the rationale against this but the implementation introduces more bugs than it tries to solve.