Advice on JVM memory settings Lucee 5.3.X Windows

I have been installing Lucee 5.3.6 on a couple of low traffic internal websites for both internal use and education purposes and to become familiar with it. I have been using the default settings and have been very pleased with the results and now wish to start using Lucee on production servers. The servers are 2016 and 2012R2 servers with 8Gb and 16Gb memory and will be hosting about 20-30 medium traffic domains with simple CF apps.

I confess to a lack of knowledge of Java settings and am looking for advice on the proper settings for an installation like this. Can anyone recommend the Initial Memory pool and maximum memory pool should be set in the Apache Tomcat 9.0 Lucee service properties for the described installations ?

Also can anyone reference tutorials or “how to’s” for setting and tuning the Lucee memoy?

Thank you.

I am not claiming to be an expert so this is based on experience and past readings on the topic. As a generalization, set both initial and maximum to 50% of installed/physical memory. Basically you want to avoid memory swapping to disk and Java spending too much time performing garbage collection. The 50% is based on seeing what else needs memory (e.g. Windows, database) and allocating the rest to Java. I have read that expanding the memory from initial to the maximum in steps at runtime is slow and inefficient so allocate it all up front, a bit like thin or thick provisioning of virtual disks. Not allocating enough memory can lead to an OutOfMemoryError and/or Java spending a lot of time performing garbage collection rather than working on your web pages. If you have the free physical memory then I don’t know if you can allocate too much to 64bit Java although with 32bit Java I found 1.5GB was the limit.

set both initial and maximum to 50% of installed/physical memory.

I appreciate the response. I haven’t worked with Java applications to this extent so can use all the guidance I can get. To be sure I understand what you are saying; for an 8Gb windows machine both the Initial Memory Pool and maximum would be 4096mb and then I can tweak as needed from there.

Dennis,

I would set both initial and maximum to 4096 MB.

This is a configuration from a server although on Saturday Lucee isn’t using much memory.

Web server: Windows Server 2016 - IIS 10
Application server: Lucee (5.3.3.62) - Apache Tomcat/9.0.24
Configuration file: Application.cfc
JVM: Oracle Corporation OpenJDK Runtime Environment 11.0.4+11
JVM free memory: 3517Mb
JVM allocated memory: 6144Mb
JVM maximum memory: 6144Mb
JVM time zone: Australia/Sydney Australian Eastern Standard Time

The above server has 16GB RAM but also runs a database (MS-SQL Server) and is currently using 14GB RAM all up.

The most I have allocated to Java on one of my servers that runs multiple websites is 10GB. It had occasional out of memory errors with 8GB allocated to Java. That server has 32GB RAM.

I am not sure when Windows chooses to start swapping memory to disk but don’t allocate so much memory to Java that there is less than 5% of total physical memory free, maybe even 10%. This is after Windows has been running for hours and all your web sites are busy.

Peter,

This has been a tremendous help. Thank you very much.