Just installed Confluence, but it's terribly slow
Asked by Manuel Finsterriegler:

I Just installed Confluence, but after I login, everything loads extremely slow.  
Each refresh takes serveral minutes, each click on a new page or even the configuration sites too.  
I'm using CentOS 7 in the most recent version. (Fresh install, just used for Confluence)  

In the Confluence Logfiles I can find several exceptions of Java "NotifyStuckThreadDetected"  

16-Sep-2019 10:46:27.023 WARNING \[Catalina-utility-1\] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDetected Thread \[http-nio-8090-exec-8\] (id=\[221\]) has been active for \[63,446\] milliseconds (since \[9/16/19 10:45 AM\]) to serve the same request for \[<http://10.199.10.6:8090/admin/viewgeneralconfig.action>\] and may be stuck (configured threshold for this StuckThreadDetectionValve is \[60\] seconds). There is/are \[1\] thread(s) in total that are monitored by this Valve and may be stuck.  
java.lang.Throwable  
at java.net.PlainSocketImpl.socketConnect(Native Method)  
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)  
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)  
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)  
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)  
at java.net.Socket.connect(Socket.java:589)  
\[...\]  
16-Sep-2019 10:47:47.033 WARNING \[Catalina-utility-1\] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadCompleted Thread \[http-nio-8090-exec-8\] (id=\[221\]) was previously repo rted to be stuck but has completed. It was active for approximately \[140,416\] milliseconds.  

At the moment, I use the default port 8090, and have no SSL Certificate till now.  
So this is plain http.  
The problem occours on different workstations, with different browsers.  
Using the IP Address instead of the URL does not work either.  
Same thing with the local browser.

Does anyone know how I can fix this error?  
If any additional information or logfiles are needed, I will provide them as neccessary.


Answers:
author: Kurt Klinner
body: [@Manuel Finsterriegler](/t5/user/viewprofilepage/user-id/3560070)

Hi Manuel

welcome to the Atlassian community.

How do the specs of your confluence server look like (CPU, RAM etc), which DMBS are you using?

Cheers

Kurt

comments: author: Manuel Finsterriegler
body: Hi!

It's installed in an ESXi VM, with 4 Cores and 8Gb of Ram, the Host CPU is an Intel Xeon E5-4620  
As Database I'm using Postgresql


author: Kurt Klinner
body: [@Manuel Finsterriegler](/t5/user/viewprofilepage/user-id/3560070)

How much Memory is configured for confluence instance?

In addition one thing to check would be the disk io, see

<https://confluence.atlassian.com/kb/testing-disk-access-speed-for-a-java-application-818577561.html>


author: Manuel Finsterriegler
body: This is my memory configuration in confluence/bin/setenv.sh:

\[...\]  
CATALINA_OPTS="-Xms2048m -Xmx4096m -XX:+UseG1GC ${CATALINA_OPTS}"  
\[...\]

Here ist the disk io diag:

java -Djava.io.tmpdir=/opt/atlassian -jar support-tools.jar  
Benchmark: RandomAccessFile

<br />

TOTALS  
---- ---- ---- ---- ----  
stat avg median min max  
---- ---- ---- ---- ----  
open 69.537 60.621 45.125 1.224.352  
r/w 19.672 16.966 11.400 197.933  
close 12.464 10.344 7.219 232.471  
delete 46.916 41.026 30.037 186.440  
---- ---- ---- ---- ----  
All times are in nanoseconds.


author: Manuel Finsterriegler
body: For testing purposes, I reinstalled confluence on Ubuntu 18.04 -\> Same Problem.  
Also, on both systems, I upgraded RAM and CPU to 12GB and 4 Cores.  
While loading the Webpage, serveral java/confluence processes eat up nearly 100% of all cores.


author: Kurt Klinner
body: [@Manuel Finsterriegler](/t5/user/viewprofilepage/user-id/3560070)

The specs look good so far from my point of view, also the io values are fine.

The next logical step would be to take a threaddump while you see the high cpu usage and to check which threads consume most of the resources

<https://confluence.atlassian.com/doc/generating-a-thread-dump-188095.html>

and

<https://confluence.atlassian.com/doc/generating-a-thread-dump-externally-182158040.html>

will guide you there.

Could you also share the whole log file of your confluence instance?

Cheers

Kurt