Logs:
SEVERE [http-nio-8080-exec-6] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/dhis] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space] with root cause java.lang.OutOfMemoryError: Java heap space
Detalis:
Windows Server 2016; RAM 512 GB (server isn’t used only for DHIS),
apache-tomcat-9.0.63
dhis2-stable-2.38.0
jdk-18.0.1.1 (x64)
I’m constantly increasing the memory size, now it is:
JAVA_OPTS: -Xms75000m -Xmx100000m -XX:PermSize=2048m -XX:MaxPermSize=2048m.
Please check the Catalina.out log file, would you share it with us (without the sensitive info)? Please check if there any tables that need to be dropped or taking too much space.
From the log you shared, I can see that your heap size is too small. You are likely setting JAVA_OPTs in the wrong place.
19-May-2022 22:09:35.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms128m
19-May-2022 22:09:35.655 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx256m
It is difficult to answer your question about how much memory DHIS2 needs without knowing your implementation size and load patterns. Some implementations have it as low as 5g, some as high as 64g.
The format looks correct to me, but these opts are not picked up - you can see max limit set to 256 (m) in “Memory info” row. Where do you set these? System variables/tomcat startup file?
I suggest taking a look at this guide then. It should have you covered on how and where to set java_opts. Alternatively, you could find resources online specific to windows server.
@Gintare & @Gassim: 1) Last version of Java (18 in my case) not understand parameters “-XX:PermSize=… -XX:MaxPermSize=…” as in this guide indicated 2) My actual JAVA_OPTS: -Xms4096m -Xmx8192m -server 3) Tu run Tomcat I am using “…\Tomcat 9.0\bin\startup.bat”, but not “Tomcat9.exe” (contrary guide indications) 4) “startup.bat” permanent say something like “JRE_HOME” is not correct…bla…bla… and I created the file “setenv.bat” with:
set “JAVA_OPTS=-Xms4096m -Xmx8192m -server”
set “JAVA_HOME=C:\Program Files\Java\jdk-18.0.1.1”
set “JRE_HOME=C:\Program Files\Java\jdk-18.0.1.1”
exit/b 0 5) Used memory must be indicated separately for Windows service (Tomcat9w.exe) like in picture: