Overview
Heap memory is the portion of memory allocated to the Java Virtual Machine (JVM) where Joget runs. When your application handles large datasets, complex workflows, or heavy concurrent traffic, the default memory settings might result in java.lang.OutOfMemoryError. Increasing the heap memory ensures the Joget server remains stable and responsive under heavy loads.
How It Works
The JVM uses the -Xmx parameter to define the maximum heap size. By modifying the Joget startup script (typically joget-start.bat or startup.bat), you tell the system how much physical RAM it is allowed to consume. For example, setting -Xmx16384M allocates 16GB of memory to the Joget instance.
Where to Use in Joget
- ✅ System Installation: Modifying the root startup files in the Joget installation folder.
- ✅ Server Administration: Optimizing performance for enterprise-level deployments.
Full Code
⚙️ Modified Startup Script (joget-start.bat)
Update your batch file by adjusting the set JAVA_OPTS line as shown below:
@ECHO OFF
chcp 65001
REM Start MariaDB
ECHO == Starting MariaDB ==
CALL .\mariadb-start.bat
REM Start Tomcat
set JAVA_HOME=.\jre11.0.18
set CATALINA_HOME=.\apache-tomcat-9.0.71
REM Increase memory by adjusting the -Xmx value (e.g., 16384M for 16GB)
set JAVA_OPTS=-Xmx16384M -Dfile.encoding=UTF-8 -Dwflow.home=./wflow/ -javaagent:./wflow/wflow-cluster.jar -javaagent:./wflow/aspectjweaver-1.9.7.jar -javaagent:./wflow/glowroot/glowroot.jar
ECHO == Starting Tomcat from %CATALINA_HOME% ==
%CATALINA_HOME%\bin\catalina.bat run
Example Use Cases
- 💡 Large File Processing: When users frequently upload or process large documents through Joget forms.
- 💡 High Concurrency: When a high volume of users are accessing the Userview simultaneously.
- 💡 Complex Reporting: Generating heavy reports using BeanShell or SQL that require significant temporary memory storage.
Customization Tips
- ⚙️ Available RAM: Never allocate more than 70-80% of your total physical RAM to the JVM to leave room for the Operating System and Database.
- ⚙️ Unit Conversion: You can use
Gfor Gigabytes (e.g.,-Xmx16G) orMfor Megabytes (e.g.,-Xmx16384M). - ⚙️ Initial Heap: You can also set the starting memory using
-Xms(e.g.,-Xms4G -Xmx16G) to prevent the JVM from constantly resizing the heap.
Key Benefits
- ✅ Stability: Eliminates "OutOfMemory" crashes during peak usage.
- ✅ Speed: Reduces the frequency of Garbage Collection (GC) pauses.
- ✅ Scale: Allows the application to handle more complex scripts and larger datasets.
Final Thoughts
Increasing heap memory is a quick and effective way to scale your Joget environment. Always monitor your server's performance after an upgrade to ensure that the hardware can support the new memory allocation.
Top comments (0)