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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,695 views 26 10
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