I installed latest confluence on ubuntu 20.04 with mysql database. System is very slow with busy CPU
Asked by ITanchor LLC:

Hi

Installed Confluence on ubuntu 20.04 with mysql. System is slow with heavy CPU. I have 4 x cpu with 8G ram allocated. No users connected but system is super slow to navigate. This is fresh installed OS and application. Can you please help us on fixing the issues.

Thank you  
Chakri


Answers:
author: ITanchor LLC
body: I am also close to giving up on this version, wanted to go back to old version. Don't see anything out of ordinary in the catalina.out but I see garbage collection logs. Once again thank you for your time and help.   

\[150915.119s\]\[info \]\[gc \] GC(1868) Pause Young (Normal) (G1 Evacuation Pause) 530M-\>484M(1024M) 221.890ms  
\[150989.809s\]\[debug\]\[gc,age\] GC(1869) Desired survivor size 3670016 bytes, new threshold 2 (max threshold 15)  
\[150990.007s\]\[info \]\[gc \] GC(1869) Pause Young (Normal) (G1 Evacuation Pause) 530M-\>483M(1024M) 198.660ms  
\[151103.073s\]\[debug\]\[gc,age\] GC(1870) Desired survivor size 5242880 bytes, new threshold 15 (max threshold 15)  
\[151103.170s\]\[info \]\[gc \] GC(1870) Pause Young (Normal) (G1 Evacuation Pause) 556M-\>485M(1024M) 97.680ms  
\[151267.163s\]\[debug\]\[gc,age\] GC(1871) Desired survivor size 6815744 bytes, new threshold 15 (max threshold 15)  
\[151267.486s\]\[info \]\[gc \] GC(1871) Pause Young (Normal) (G1 Evacuation Pause) 581M-\>487M(1024M) 326.131ms  


author: ITanchor LLC
body: Here is the CATALINA_OPTS

CATALINA_OPTS-XX:ReservedCodeCacheSize=256m -XX:+UseCodeCacheFlushing -Djdk.tls.server.protocols=TLSv1.1,TLSv1.2 -Djdk.tls.client.protocols=TLSv1.1,TLSv1.2 -Dconfluence.context.path= -Datlassian.plugins.startup.options='' -Djava.locale.providers=JRE,SPI,CLDR -Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 -Dsynchrony.enable.xhr.fallback=true -Xms1024m -Xmx1024m -XX:+UseG1GC -Datlassian.plugins.enable.wait=300 -Djava.awt.headless=true -XX:G1ReservePercent=20 -Xloggc:/opt/atlassian/confluence/logs/gc-2020-10-22_20-59-38.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M -Xlog:gc+age=debug:file=/opt/atlassian/confluence/logs/gc-2020-10-22_20-59-38.log::filecount=5,filesize=2M -XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution -XX:+IgnoreUnrecognizedVMOptions


author: ITanchor LLC
body: ![Xms_Xmx.png](https://community.atlassian.com/t5/image/serverpage/image-id/115393i4186A5478B190E4D/image-size/large?v=v2&px=999 "Xms_Xmx.png")


author: ITanchor LLC
body: Thank you for your time. Attached is the screenshot of Java VM memory. ![Java_VM_Memory.png](https://community.atlassian.com/t5/image/serverpage/image-id/115391i06AB37AE307FAABE/image-size/large?v=v2&px=999 "Java_VM_Memory.png")


author: ITanchor LLC
body: I don't have any apps running. This is just a base installation with both postgres or mysql ( tried both ). More seems like a JAVA issue. Any suggestion on Java tuning?   
Ram --\> 8G  
CPU --\> 4 x vcpu   

Thank you


author: Brant Schroeder
body: Chakri,

Do you have any other applications on the server? Is there any antivirus running? Are you seeing any errors in the logs? If you can provide a little more information that would be great.

Usually this is due to a RAM issue. I would suggest also looking at this article about tuning your application. <https://confluence.atlassian.com/doc/performance-tuning-130289.html>

comments: author: ITanchor LLC
body: No this is a dedicated server with fresh installation of OS, confluence and mysql database with JDBC drivers.   

Confluence version --\> atlassian-confluence-7.8.1  
OS --\> Ubuntu 20.04  
Mysql --\> mysql Ver 8.0.21  

# cp /usr/share/java/mysql-connector-java-8.0.21.jar /opt/atlassian/confluence/confluence/WEB-INF/lib/

<br />

Using top command, I could see all the 4 CPU threads to 100%.   

Thank you  
Chakri  


author: ITanchor LLC
body: I re-installed the OS and application with postgres. Still the same CPU high load issues. Any help is appreciated.

Thank you  


author: Brant Schroeder
body: Can you provide some additional information.

* What is being produced in the logs?
* Since the CPUs are tapped can you run a thread dump - <https://confluence.atlassian.com/doc/generating-a-thread-dump-188095.html>


author: Brant Schroeder
body: One other thing to try is running the apps in safe mode. This will disable all apps and see if it runs better - <https://confluence.atlassian.com/upm/disabling-and-enabling-apps-273875716.html>

Also do you have collaborative editing turned on? Is so can you turn it off and see if that resolves the issue.


author: Brant Schroeder
body: Confluence will have apps running by default and if one does not load it will can cause issues. Lets start over and have a look at a couple of things in Confluence.

checking the memory that Confluence is using by going here:
> 1- Click the **cog icon at the top right corner**   
> 2- Select **General Configuration**   
> 3- Search for **System Information** in the left side panel  
> 4- Once you are there, scroll down until you find **Java VM Memory Statistics** section  
> 5- If possible, take a screenshot of **only the memory usage** and share it here with us

Further, could you share with us some information on the **XMS and XMX values** that are set for your Confluence instance?  
You can find these values under:
> - \<cofluence-install\>/bin/setenv.sh file


author: Brant Schroeder
body: What are you seeing in the logs?


author: Brant Schroeder
body: Can you try increasing the ram. Looks like the garbage collection is constantly running.

Try boosting it to **at least 2GB of heap**. You can check this article on how to increase memory:

**[How to fix out of memory errors by increasing available memory](https://confluence.atlassian.com/confkb/how-to-fix-out-of-memory-errors-by-increasing-available-memory-154071.html)**


Tags: confluence-server

server