UserAccessor.removeUsers takes a lot of time

Shravan P June 23, 2014

I am trying to remove certain users from confluence as a bulk operation. I see that a call to this method takes close to 30 sec for one user. To delete 50 users, it takes 25 min. UserAccessor.removeUsers removes the users association with groups before removing the user. I tried doing this myself but I dont see any performance improvement. This is the code i am using:

User user = userAccessor.getUserIfAvailable(email);
                if (user != null) {
                    Pager<Group> pager = groupManager.getGroups(user);
                    Iterator pgit = pager.iterator();
                    while(pgit.hasNext()){
                        Group g = (Group)pgit.next();
                        groupManager.removeMembership(g, user);
                        LOG.debug("Removed membership="+g.getName());
                    }
                    userAccessor.removeUser(user);
                    LOG.debug(count+". Removed user=" + email);
                    count++;
                }

Since I need to delete about 1000 users, this is taking a lot of time. Anybody know how to speed up the process?

1 answer

0 votes
Bruna Griebeler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2014

Hi Shravan,

How is the database latency? (this information is set on your confluence logs).

If it's database related, check also for the Database connection pool (you might increase it and check if the delay decrease):

https://confluence.atlassian.com/display/DOC/Performance+Tuning

Shravan P June 24, 2014

Thanks for the reply Bruna. The latency is 1ms to 2ms. I also went and checked the cache tuning document: https://confluence.atlassian.com/display/DOC/Cache+Performance+Tuning

Since this is a user deletion operation, I flushed the user related caches. I expected some performance improvement since the user deletion now wouldnt have to update the cache. But I was wrong. It took the same amount of time.

You see, in our dev server it is taking 30 sec to delete the user. But on our production server, it is taking 9 min to delete one user. And this is adding quite a bit of load on the server too.

Anything else I should try?

Thanks,

Shravan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events