Swapping analytics table takes too long while running analytics

Hi all
Lately I’ve having an issue while running analytics. Everything seems to be running well until the task “Swapping analytics tables” starts. That task can take up to 2 hours.
Screenshot from 2023-05-19 14-33-25

Could anyone help me on fixing this issue? What I do that works is to shutdown Tomcat, restart Postgres service, and then start Tomcat. After this if I run analytics, it will run smoothly as expected.
My server specs are:
CPU cores = 8
RAM = 32GB
OS = Ubuntu 18.04
PostgreSQL 13.10
Tomcat 9
Java 11, -Xms8184m -Xmx12288m

Best regards

Hi @joao.machiana

I believe this issue has relation to the Postgresql memory configuration.
Therefore please check this article and try to reconfigure your Postgresql.

Regards

2 Likes

Hi @Ulanbek

Thank you for the article. I took in consideration the concenpts referred in the article and tried to do some more tuning of my Postgres configuration, but the issue still remains, and sometimes even after restarting Tomcat and Postgres, when running analytics again it gets stuck on that process, “Swapping analytics table”

Hi @joao.machiana

Let’s take following steps to illuminate the issue sources :

  1. stop your DHIS2 instance: tomcat and postgresql.
  2. clear all tomcat, postgre and dhis2 logs
  3. restart all services
  4. clear analytics table, do maintenance work
  5. run analytics
  6. check your logs for any errors

Other reason for this maybe RAM/HDD/SSD errors. Please check them as well.

Otherwise I cannot see any issues there

Regards,

Ulanbek