UserAccessor.removeUsers takes a lot of time

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

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

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
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,102 views 17 14
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you