Tomcat 8 - Serving Static content extremely slow...

B_ Normann P_ Nielsen
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.
September 17, 2015

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
chucktalk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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

B_ Normann P_ Nielsen
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.
September 17, 2015

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....

Dmitry [Lucidchart] February 14, 2018

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

0 votes
Remo Siegwart
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.
December 6, 2015

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.

0 votes
William Zanchet [Atlassian]
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.
September 17, 2015

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

B_ Normann P_ Nielsen
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.
September 17, 2015

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 :-)

0 votes
B_ Normann P_ Nielsen
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.
September 17, 2015

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events