We are in the process of migrating our data to the DHIS2 platform using the API. During this process, we encountered an issue where the Tomcat service suddenly stopped, resulting in a 502 Bad Gateway error on the browser.
Upon further investigation, it was found that the RAM utilization exceeded 97%, causing the Tomcat service to stop. Additionally, several PostgreSQL processes on the server were in an idle state for more than 2-3 hours. After restarting the PostgreSQL services, the RAM utilization dropped to only 500MB out of 16GB.
Do we have any solutions to manage RAM utilization more effectively and to automatically kill idle PostgreSQL processes to prevent this issue from recurring?