Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16257

adjust cache size & disable unneeded tomcat8 features for debian xwiki-tomcat8-* packages



    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.11, 11.1
    • Fix Version/s: 11.2-rc-1, 10.11.4
    • Component/s: Distribution - Debian
    • Labels:
    • Environment:
      google-compute-engine deployment of XWiki running on  "Ubuntu 18.04.2 LTS" using its tomcat8 (8.5.30) mysql (5.7.25) and openjdk-8-jre-headless (8u191-b12) packages: 
    • Difficulty:
    • Documentation:
    • Documentation in Release Notes:
    • Similar issues:


      Although closed in XWIKI-16236 (see also XWIKI-15756) I re-examined the cache-size issue and have found that a much lower value is sufficient; even lower than the original "20480" value which is 100% larger than the default tomcat value. I was able to get no warnings (as in XWIKI-16236 ) going all the way down to 10% larger than the default value at "11264".

      However in all cases, on shutdown there are warnings, and even worse, there were stacktraces prior to my clearing the cache via Admin.FlushCache app in Admin Tools. I wonder whether some kind of cache corruption resulted in my need for much larger values, as the original "20,480" value worked fine, either after cache clearing, or after performing the optimization below:

      I applied some further optimizations to tomcat8 per https://tcollignon.github.io/2016/02/09/Accelerate-tomcat-78-start-up.html and https://wiki.apache.org/tomcat/HowTo/FasterStartUp. Specifically, disabling JSP and WebSocket support, and removing the default home page at "webapps/ROOT". So it is unclear whether the cache-clearing or the removal of unneeded features in tomcat ended up not causing the cache warning messages on startup seen in XWIKI-16236. The optimizations are already part of


      but were missing in the debian tomcat8 distribution.

      With above optimization the following lines of output no longer appear in catalina.out and the application exhibits overall faster startup.

      15-Mar-2019 20:26:13.733 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/var/lib/tomcat8/webapps/ROOT]
      15-Mar-2019 20:26:14.730 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
      15-Mar-2019 20:26:14.744 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/var/lib/tomcat8/webapps/ROOT] has finished in [1,011] ms

      The proposed update is to the same file of my recent PR associated with XWIKI-16236. also updated the documentation to be consistent as per Vincent Massol's comments on github: https://github.com/xwiki/xwiki-platform/pull/1083

      The following is the proposed xwiki-tomcat8.xml:

        Context configuration file for the XWiki Web App
        This file is used only for Tomcat8 deployment of XWiki via debian packages.
        It is equivalent to, and needs to be kept up to date with traditional
        deployment file:
        Prevent JAR scanning and disable WebSocket and JSP support. 
        This is done to optimize Tomcat startup time, per
        https://wiki.apache.org/tomcat/HowTo/FasterStartUp &
        (see: "Disable scanning the web application", 
              "Disable scanning web-fragment jar",
              "Disable both WebSocket and JSP support (only tomcat 8)", 
              "Excludes jars for scanning")
      <Context path="/xwiki" docBase="/usr/lib/xwiki"
        <!-- Make symlinks work in Tomcat, and fix problem described in
             XWIKI-16236 & XWIKI-15756 causing catalina.out warnings on "evicting
             expired cache entries", which is solved by increasing the cache
             size. -->
          <Resources allowLinking="true" cachingAllowed="true"
      	     cacheMaxSize="12800" cacheObjectMaxSize="640" />
        <!-- Disable JAR scanning since Xwiki does not need that -->
        <JarScanner scanClassPath="false">
          <JarScanFilter defaultTldScan="false"/>

      Note the above uses a cache size of 125% of the default. Although 110% works (11264), it is not a "nice size" for a cache (and results in noninteger cacheObjectMaxSize suggested by tomcat docs), so I went with "12800"


          Issue Links



              nielsmayer Niels Mayer, http://nielsmayer.com
              nielsmayer Niels Mayer, http://nielsmayer.com
              0 Vote for this issue
              2 Start watching this issue


                Date of First Response: