Tomcat 8 - Serving Static content extremely slow...

After upgrading my Confluence to newest (and hence Tomcat 8), serving some static content became extremely poor in performance.

I have the AllowLinking=true, so some js scripts and css resources could be fetched from the filesystem. No problem until Tomcat 8, where the time from the server went to:

Screen Shot 2015-09-17 at 17.58.03.jpg

Uploading the files to Confluence and making a link to /download/xxxxxxx/filename.js solved the issue, and the time for the 2 files is roughly around 64ms per file. This is an acceptable solution, as migrations and stuff gets a bit simpler, but still... why the extreme poor performance. No changes to OS og Filesystem or similar, just the upgrade.....

4 answers

1 vote
Chuck Talk Atlassian Team Sep 17, 2015

Hi Normann,

I am not sure of your network setup, but you can add the following to your Connector parameter within server.xml:

<Connector port="8575" connectionTimeout="20000" redirectPort="8443"
maxThreads="200" minSpareThreads="10" compression="on"
compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,image/gif,image/jpg,image/png"
protocol="org.apache.coyote.http11.Http11NioProtocol"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" />

That should help with delivery of the static resources. In the alternative, you could use an Apache front-end to cache the static resources for delivery to end users as well.

Sincerely,

Chuck

Sounds interesting, and Apache has always been the frontend - but I dont want to "disconnect" resources to much from the Confluence Instance. I will look into the compression though....

I had to also add `useSendfile="false"` to the Connector element in order for the compression to work. 

Afterwards I have swiched from Apache2 to NGIX and killed a lot of old not used plugins to finetune.

Hi Normann,

If you upgraded Confluence out-of-the-box, it's more likely that you're with the default memory settings. Would you mind checking the following?

To increase the JVM memory, here are the steps:

Linux:

# From <confluence-install>/bin (Stand-alone) or <Tomcat-home>/bin (EAR-WAR installation), open setenv.sh (you can create this file in the EAR/WAR version).
# Find the section JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=256m ...
# See Diagnosis above and enter the appropriate values. Xmx is maximum, Xms is minimum, and MaxPermSize is PermGen.

Windows:

# From <confluence-install>/bin (Stand-alone) or <Tomcat-home>/bin (EAR-WAR installation), open setenv.bat.
# Find the section set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m -XX:MaxPermSize=256m
# See Diagnosis above and enter the appropriate values. Xmx is maximum, Xms is minimum, and MaxPermSize is PermGen.

Running Confluence as a Service:

* You can scroll down to Windows Service section: https://confluence.atlassian.com/display/CONFKB/How+to+Fix+Out+of+Memory+Errors+by+Increasing+Available+Memory#HowtoFixOutofMemoryErrorsbyIncreasingAvailableMemory-SettingPropertiesforWindowsServicesviatheWindowsRegistry]


For more information, you can refer to this documentation: :How to Fix Out of Memory Errors by Increasing Available Memory:
https://confluence.atlassian.com/display/CONFKB/How+to+Fix+Out+of+Memory+Errors+by+Increasing+Available+Memory#HowtoFixOutofMemoryErrorsbyIncreasingAvailableMemory-Step2:IncreaseAvailableMemory].


Cheers,
WZ

Current config (as before): -Djava.util.logging.config.file=/opt/confluence/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -XX:-UseAESIntrinsics -Djava.awt.headless=true -Xloggc:/opt/confluence/logs/gc-2015-09-17_18-42-22.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M -XX:-PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution -Xms2048m -Xmx2048m -XX:MaxPermSize=1024m -XX:+UseG1GC -Djava.endorsed.dirs=/opt/confluence/endorsed -Dcatalina.base=/opt/confluence -Dcatalina.home=/opt/confluence -Djava.io.tmpdir=/opt/confluence/temp I always (after upgrade) - need to change settings in setenv.sh - And I can for sure set it higher, but this is a small website for my personal use only .... But thanx for the answer :-)

We've experienced similar issues with custom and even Confluence supplied JS files: https://jira.atlassian.com/browse/CONF-39298 In our case, it looks like only JS files are affected by this issue.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

698 views 21 12
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