Setting Heap Size (Linux Server)

I could not find this in the Lucee documentation, so I wanted to check how to properly set the heap size on a Linux server (Ubuntu in my case).

Is this the proper procedure:

1. Create setenv.sh file
Create a file new named setenv.sh in the following location.

sudo nano /opt/lucee/tomcat/bin/setenv.sh

2. Add the JAVA_OPTS line
In the file, add JAVA_OPTS line with the desired memory values. For example:

JAVA_OPTS="-Xms256m -Xmx512m";

Save the file.


Questions

  • What restart command do I then use so that these values go into effect?

  • How can I check the heap settings? I want to verify the new values are being used.

  • What are the recommended min and max heap settings for a 2 Gb server?

1 Like
sudo systemctl start tomcat

Lucee func:
GetMemoryUsage( 'heap' );
GetMemoryUsage( 'non_heap' );

if the server is dedicated only to tomcat/lucee I set half of the total available.

If you used CommandBox you could simple set the jvm values from the server.json:

     "JVM":{
         "minHeapSize":"9144",
         "heapSize":"12168"
     }

hth

2 Likes

The server runs Lucee, Apache, and MySQL on the same box. In that case, what would be the recommended min and max heap size for the 2 Gb RAM server?

This depends on the reserved memory for MySQL.

Does restarting lucee with the command below also restart tomcat?

 sudo /opt/lucee/lucee_ctl restart