Job taking too long time to create new pages

José Jeria June 11, 2012

I have created a plugin (type=job) that loads data and then creates pages. Around 3000 pages are created and performance on our production server is much slower than while developing with the SDK.

The actual code to create the pages is pretty straightforward:

overviewPage = new Page();
overviewPage.setTitle(getPageOverviewTitle());
overviewPage.setSpace(space);
overviewPage.setParentPage(homePage);
overviewPage.setBodyAsString(getOverviewPageAsString());
homePage.addChild(overviewPage);

pageManager.saveContentEntity(overviewPage, null);

Creating a page takes around 15 milliseconds but over 2000 milliseconds on our production server. Enabling profiling gives the following in the logs:

2012-06-11 15:27:59,048 DEBUG [scheduler_Worker-5] [atlassian.util.profiling.UtilTimerStack] log [2842ms] - ContentEntityManager.saveContentEntity()
  [0ms] - UserAccessor.getPropertySet()
  [0ms] - UserAccessor.getUserProfilePicture()
  [0ms] - UserAccessor.getUserProfilePicture()
  [656ms] - NotificationManager.getNotificationsBySpaceAndType()
  [689ms] - NotificationManager.getNotificationsByPage()
  [5ms] - LinkManager.updateOutgoingLinks()

Is there any reason why so much time is spent on the methods called by the NotificationManager?

I guess this is pretty vague, but any help would be appreciated. Thanks.

3 answers

0 votes
Radu Dumitriu
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.
February 17, 2013

Do you really want to notify your users that you just created 3000 pages ? R K above is right.

Your answer is here:

com.atlassian.confluence.core.SaveContext

boolean isMinorEdit()
Minor edits indicate that notifications should not be sent out informing users of changes made to the page.

http://docs.atlassian.com/atlassian-confluence/3.1/com/atlassian/confluence/core/DefaultSaveContext.html

0 votes
R K February 17, 2013

My guess is that your production server contains different, and more, watchers or users. Which, upon creation, are all notified or checked if they need notifications. Could that be the explanation?

0 votes
Harry Chan
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.
February 6, 2013
[656ms] - NotificationManager.getNotificationsBySpaceAndType()
[689ms] - NotificationManager.getNotificationsByPage()
Would be the issue. Is the cache for these full? Maybe you can increase them. I would also do some SQL profiling on it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events