I would like to ask for asistance with a DHIS analytics problem we are facing.
We have recently seen a growth in the volume of data being fed to the DHIS2 system so we are now experiencing slowness in the time the analytics server processes querries. I set up 3 read-only database replicas to complement the existing Postgres DB but I am not seeing an improvement in the time it takes the Analytic engine to process queries.
It used to take one 1hour for the Analytics to process queries but now it takes about 8hrs or so. I fine-tuned the Postgres master and replica DBs in accordance with the DHIS manual. How best can I troubleshoot this slowness issue.
When you say “time to process queries”, do you mean the API calls to /analytics (loading visualizations) or the time it takes to run the analytics process ( from data administration or scheduler apps)?
I mean the time it takes to run the analytics process. below is a snippet of the processes I am referring to. It will take several hours at the “Populating analytics tables” stage.
Thanks for clarifying. Which postgres version are you using? We have seen reports that suggest that PG13 works best for analytics. Do you have any monitoring tools installed on the server? Would be interesting to see the server performance, test the disk speed during the analytics run. You could try to increase shared_buffers pg setting and “keyDatabaseServerCpus” systemSetting (/api/systemSettings).
We are running Postgres version 12. I have increased the shared_buffers parameter from 3GB to 16GB but there isn’t much change.
“keyDatabaseServerCpus” is currently set to “0” does this translate to "unlimited’’ ? .
I have attached images showing the disk throughput
.
Today’s logs
2021-08-20 01:19:54
Analytics table update process started
2021-08-20 01:19:54
Updating resource tables
2021-08-20 01:20:59
Updating tables: DATA_VALUE
2021-08-20 01:20:59
Performing pre-create table work
2021-08-20 01:20:59
Dropping temp tables
2021-08-20 01:20:59
Creating analytics tables
2021-08-20 01:20:59
Populating analytics tables
2021-08-20 01:20:59
Invoking analytics table hooks
2021-08-20 01:20:59
Applying aggregation levels
2021-08-20 01:20:59
Creating indexes
2021-08-20 01:20:59
Analyzing analytics tables
2021-08-20 01:20:59
Removing updated and deleted data
2021-08-20 01:20:59
Swapping analytics tables
2021-08-20 01:21:00
Table update done
2021-08-20 01:21:00
Updating tables: COMPLETENESS
2021-08-20 01:21:00
No complete registrations exist, not updating completeness analytics tables
2021-08-20 01:21:00
Updating tables: COMPLETENESS_TARGET
2021-08-20 01:21:00
Performing pre-create table work
2021-08-20 01:21:00
Dropping temp tables
2021-08-20 01:21:00
Creating analytics tables
2021-08-20 01:21:00
Populating analytics tables
2021-08-20 01:21:00
Invoking analytics table hooks
2021-08-20 01:21:00
Applying aggregation levels
2021-08-20 01:21:00
Creating indexes
2021-08-20 01:21:00
Analyzing analytics tables
2021-08-20 01:21:01
Removing updated and deleted data
2021-08-20 01:21:01
Swapping analytics tables
2021-08-20 01:21:01
Table update done
2021-08-20 01:21:01
Updating tables: ORG_UNIT_TARGET
2021-08-20 01:21:01
Performing pre-create table work
2021-08-20 01:21:01
Dropping temp tables
2021-08-20 01:21:01
Creating analytics tables
2021-08-20 01:21:01
Populating analytics tables
2021-08-20 01:21:01
Invoking analytics table hooks
2021-08-20 01:21:01
Applying aggregation levels
2021-08-20 01:21:01
Creating indexes
2021-08-20 01:21:01
Analyzing analytics tables
2021-08-20 01:21:01
Removing updated and deleted data
2021-08-20 01:21:01
Swapping analytics tables
2021-08-20 01:21:01
Table update done
2021-08-20 01:21:01
Updating tables: EVENT
2021-08-20 01:33:12
Performing pre-create table work
2021-08-20 01:33:12
Dropping temp tables
2021-08-20 01:33:12
Creating analytics tables
2021-08-20 01:33:13
Populating analytics tables
2021-08-20 03:19:26
Invoking analytics table hooks
2021-08-20 03:19:26
Applying aggregation levels
2021-08-20 03:19:26
Creating indexes
2021-08-20 03:58:13
Analyzing analytics tables
2021-08-20 04:00:22
Removing updated and deleted data
2021-08-20 04:00:22
Swapping analytics tables
2021-08-20 04:00:40
Table update done
2021-08-20 04:00:40
Updating tables: VALIDATION_RESULT
2021-08-20 04:00:40
No validation results exist, not updating validation result analytics tables