[ https://issues.apache.org/jira/browse/RANGER-2789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17080429#comment-17080429 ]
RickyMa edited comment on RANGER-2789 at 4/10/20, 11:48 AM: ------------------------------------------------------------ I've already uploaded the patch. By applying this patch, the response time has decreased from 10+ minutes to 30 seconds in our production environment. The problem of this issue is that the original code will query the database for every one of the 1000+ users: [https://github.com/apache/ranger/blob/master/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java#L84] !image-2020-04-10-19-37-31-570.png! The main ideas of the uploaded patch are: # Find all users in the database at one time. # Use HashMap as cache to store all the database info in memory. # Just use the cache during any follow-up db operation. was (Author: rickyma): I've already uploaded the patch. By applying this patch, the response time has decreased from 10+ minutes to 30 seconds in our production environment. The problem of this issue is that the original code will query the database for every one of the 1000+ users: [https://github.com/apache/ranger/blob/master/security-admin/src/main/java/org/apache/ranger/service/XUserServiceBase.java#L84] !image-2020-04-10-19-37-31-570.png! The main ideas of the uploaded patch are: # Find all users in the database at one time. # Use HashMap as cache to store all the database info in memory. # Any follow-up db operation can just use the cache. > GET API service/xusers/users turns very slow when there are more than 1000 > users > -------------------------------------------------------------------------------- > > Key: RANGER-2789 > URL: https://issues.apache.org/jira/browse/RANGER-2789 > Project: Ranger > Issue Type: Bug > Components: Ranger > Affects Versions: 2.0.0 > Environment: hdp 2.2 > Reporter: RickyMa > Priority: Minor > Labels: optimization, performance, ranger, rangeradmin, slow > Attachments: RANGER-2789.patch, image-2020-04-10-19-37-31-570.png > > Time Spent: 10m > Remaining Estimate: 0h > > We have more than 1000 users in production environment. > When calling API 'service/xusers/users?pageSize=1000&startIndex=0' using HTTP > GET method, Ranger Admin takes 10+ minutes to response. -- This message was sent by Atlassian Jira (v8.3.4#803005)