Confluence slow to start on Debian 9
Asked by Adam Severns:

I can start Confluence manually via the script included (start-confluence.sh), or start it as a service. However, after the service starts, the first page takes 10-20 minutes to load. This did not occur with Debian 8 or even Ubuntu 17.04, which is based on Debian 9. This is a clean install of Debian 9, virtualized. I've allocated 8 processor cores, 4GB RAM, and 32GB SSD space to this VM.

I am a single user with \~20 pages. My automatic backups are about 12MB in size, just to give you an idea.

Running "top" on my Debian host, I can see that... pretty much nothing is happening CPU wise when the main page is not loading. Running a status check on confluence service during this time comes back with it being active.

Also, when will Confluence be able to use systemd for the service natively? I reported the issue months ago, with a fix, and still nothing.


Answers:
author: AnnWorley
body: I understand your Confluence instance starts quickly when you use the startup script in \<Confluence_Install\>/bin but when you start it as a service it takes 10 - 20 minutes for the login page to come up. Is it possible that the environment variables are different when the service is used?

Please tail the logs during the start-up to see what is taking so long. The logging starts with \<Confluence_Install\>/logs/catalina.out, then when Tomcat is up, the application logs to \<Confluence_home\>logs/atlassian-confluence.log. Your Debian system logs may also provide a clue.

<br />

While I understand the concern, it is unlikely that we will bundle the systemd functionality with Confluence as it is perceived to be an OS function and not part of Confluence.

<br />

I agree that the docs should be current. I found your support ticket from May 2017. I opened a request for our technical writers to update [Start Confluence Automatically on Linux](https://confluence.atlassian.com/doc/start-confluence-automatically-on-linux-183148.html) and included a link to the procedure you recommended in the support ticket.

comments: author: Adam Severns
body: Ann, thanks for the quick reply.

Confluence starts slowly when I start it manually or with the service, there is no perceivable difference.

I've located the two logs files mentioned. I stopped Confluence, then deleted the logs. Then started Confluence. So these logs should only contain useful data.

catalina.out looks fine.

atlassian-confluence.log spams this error, once per minute, for 6ish minutes, after which point the GUI becomes accessible:

here is the snippet that repeats: <https://pastebin.com/RTayczFX>


author: AnnWorley
body: That warning message is a health check for collaborative editing:

```
could not ping the synchrony-proxy [http://127.0.0.1:8090/synchrony-proxy/healthcheck]
```

If you are using SSL and the healthcheck is using http instead of https you may be running into this:[Confluence incorrectly using HTTP protocol to reach synchrony-proxy during healthcheck when running over SSL](https://jira.atlassian.com/browse/CONFSERVER-45555) The suggested workarounds on the bug are to disable the health check or set up a connector in Tomcat just for the health check. Even if it isn't related to SSL, it sounds like that health check is slowing down your start-up so you may consider disabling it to isolate the issue.

I am curious whether Collaborative Editing is working on your instance. If not, please review: [Troubleshooting Collaborative Editing](https://confluence.atlassian.com/doc/troubleshooting-collaborative-editing-858772087.html) There are a lot of variables for ensuring it works.


author: Adam Severns
body: Ann,

I do not use SSL. Just using the Confluence default. I took a look in Settings \> Collaborative Editing. It said the editing was on, and Synchrony was running. I turned off collaborative editing, but the slow start issues persist.

Per your link, I also added

```
CATALINA_OPTS="-Dsynchrony.proxy.healthcheck.disabled=true ${CATALINA_OPTS}"
```

to the bottom of my setenv.sh file. Didn't make a difference. The line wasn't there, I had to add the whole thing.

Any more ideas?


author: AnnWorley
body: When you say it didn't make a difference, does that mean the health check warning is still repeating over and over during start-up? It should have been disabled so we should be seeing something else. If you are seeing something else in the log now, please let me know. If that message is still filling the log then the catalina options are somehow not being picked up by Java.

You should be able to access Confluence as soon as the atlassian-confluence.log says "Confluence is ready to serve". Please let me know if this is the case.


author: Adam Severns
body: Yes, the health check is still happening. Slow boot times are as well.

I am able to access the Confluence interface once the log says it's ready.


author: AnnWorley
body: Thanks for letting me know that you can get to Confluence immediately when it says its ready to serve. It isolates the issue more to the application by ruling out network or browser issues.

I am curious how the health check can still be running since we disabled it.

For the setenv.sh, you mentioned you added the argument at the bottom of the file. Was it at the very bottom or was it above the "export CATALINA_OPTS" line? If it is below that line, Confluence won't pick it up.


author: Adam Severns
body: I've pasted the bottom of my setenv.sh file.

CATALINA_OPTS="-XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution ${CATALINA_OPTS}"  
CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-\`date +%F_%H-%M-%S\`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}"  
CATALINA_OPTS="-XX:G1ReservePercent=20 ${CATALINA_OPTS}"  
CATALINA_OPTS="-Djava.awt.headless=true ${CATALINA_OPTS}"  
CATALINA_OPTS="-Datlassian.plugins.enable.wait=300 ${CATALINA_OPTS}"  
CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:+UseG1GC ${CATALINA_OPTS}"  
CATALINA_OPTS="-Dsynchrony.enable.xhr.fallback=true ${CATALINA_OPTS}"  
CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 ${CATALINA_OPTS}"  
CATALINA_OPTS="${START_CONFLUENCE_JAVA_OPTS} ${CATALINA_OPTS}"  
CATALINA_OPTS="-Dconfluence.context.path=${CONFLUENCE_CONTEXT_PATH} ${CATALINA_OPTS}"  
CATALINA_OPTS="-Dsynchrony.proxy.healthcheck.disabled=true ${CATALINA_OPTS}"

export CATALINA_OPTS


author: AnnWorley
body: I tried the same on my test instance and was able to disable the health check.

So we can get a more complete understanding of your environment and logs, I created a support ticket for you. You will get an email from our portal shortly.

Once we work out what is causing the slow startup we can follow up on this thread to let the Community know.


author: Kiran John
body: Can you share the support ticket number for this issue?


Tags: synchrony