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

Certain JavaScript resource requests are slow due to the ThreadLocalCache not being initialised

    XMLWordPrintable

Details

    Description

      Symptoms

      Requesting certain JavaScript resources can be quite slow. The problem is even worse on instances where plugins add a lot of JavaScript to the batches or where user lookups are slow.

      Technical Explanation

      When certain resources are requested, the thread local caches does not get initialised because the UrlRewriteFilter forwards the request and the ThreadLocalCacheFilter never runs.

      This causes certain calls (such as getLocale in DefaultLocaleManager) not to use any caching. Then, transformers such as the i18n JavaScript transformer, which use things like the LocaleManager end up running very slowly because they end up doing an uncached getUser call for each and every instance of getText in the JavaScript.

      Fix

      The fix is to edit the web.xml file and move the following snippet:

      <filter-mapping>
          <filter-name>UrlRewriteFilter</filter-name>
          <url-pattern>/s/*</url-pattern>
      </filter-mapping>
      

      down so that it is right above this line:

      <!-- Plugins 2.5 filter changes -->
      

      If the log messages continue upgrading to Confluence 5.0 or higher will fix it, or if that is not an option, you can add this to your log4j.properies file and add:

      log4j.logger.com.atlassian.confluence.cache.ThreadLocalCache=ERROR
      

      To avoid restarting Confluence for it to pick up the change, you should also add this to your "Logging and Profiling" admin page:

      Class/Package Name com.atlassian.confluence.cache.ThreadLocalCache
      New Level ERROR

      Attachments

        Issue Links

          Activity

            People

              nbhawnani Niraj Bhawnani
              nbhawnani Niraj Bhawnani
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: