Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-33420

Confluence blog-posts macro renders entire blog body even when only the title is required

    XMLWordPrintable

Details

    Description

      After upgrading to Confluence 5.4.4 we discovered that the blog-posts macro is now taking a very long time to render. In the first reports it was passing 120 seconds and the renderer was timing out. For smaller cases it still took 20 seconds, 40 seconds, or 60 seconds.

      In the case of around 20 seconds... it was only matching 7 blog posts generating a 7 row table! We think this is not reasonable, especially since we rely on blog-posts to list the titles of 30 or more blog posts in some places, and these are taking 60 seconds or timing out at 120 seconds.

      We use blog posts for many purposes. One of these purposes is meeting minutes. Meeting minutes can get reasonably long (3 or more pages) and meeting minutes can include many references to the JIRA issue macro. In this case, I believe the JIRA issue macro in Confluence 5.4.4 has become very slow to render and this has made the problem with blog-posts much more severe as a result.

      After significant analysis, I believe the problem is as follows:

      1) The blog-posts macro first searches for all matching blogs. (FAST)
      2) The blog-posts macro then renders each matching blog. (VERY SLOW)
      3) The blog-posts macro then passes this rendered content into the velocity macro for output. (FAST)

      In this case, we only want titles. So, why is the blog-posts macro fully rendering every single matching blog content just to display the blog title?

      I created this patch to the Confluence Advanced Macros Plugin:

      diff --git a/src/main/java/com/atlassian/confluence/plugins/macros/advanced/BlogPostsMacro.java b/src/main/java/com/atlassian/confluence/plugins/macros/advanced/BlogPos
      index 91a77d1..fddcd3e 100644
      --- a/src/main/java/com/atlassian/confluence/plugins/macros/advanced/BlogPostsMacro.java
      +++ b/src/main/java/com/atlassian/confluence/plugins/macros/advanced/BlogPostsMacro.java
      @@ -519,6 +519,13 @@ public class BlogPostsMacro extends ContentFilteringMacro implements Macro
            */
           private String getContent(BlogPost post, String contentType)
           {
      +        if (CONTENT_TITLES.equals(contentType) || CONTENT_TITLES_ALIAS.equals(contentType))
      +        {
      +            // Caller wants the title only. No need to return any content.
      +            return "";
      +        }
      +
      +
               String excerpt;
               if (CONTENT_EXCERPTS.equals(contentType))
               {
      

      Before deploying this change, I could see side by side that both production and test environments were very slow. For my chosen test case, it was taking between 20 and 30 seconds to display just 7 blog post titles. This was every time on reload.

      After deploying this change to our test environment... the test environment now completes in about 2 seconds for the same 7 blog post titles.

      I will chase down the "why" of "why are the blog posts' content being rendered so slow" as a separate issue. For now, please accept that some pages do render more slowly than other pages, and I think it is important that Atlassian patches blog-posts to not render the entire blog post content, when only the blog post titles are necessary as this will significantly cut down on the processing power required for this macro in a very common use case.

      If we ask for the blog post content, and each blog post content takes a while to render, then this is reasonable. If we ask for the blog post title, and each blog post content takes a while to render, this is not reasonable.

      I think this is a simple fix for you and because Confluence 5.4.4 has regressed in a major way for a primary function (at least for us), I would like this fix to be considered critical.

      Thanks!

      Attachments

        Issue Links

          Activity

            People

              qpham@atlassian.com Quan Pham
              02b1b11374fa markmielke
              Votes:
              7 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: