Best memory settings for Lucee under Windows

Hi,

We got out of memory errors, probably because we didn’t change the default settings in the Apache Tomcat Lucee properties.

What do you recommend for a server with 16 GB of physical ram for :

  • Initial memory pool
  • Maximum memory pool

Is 4 GB fine? Too much? Not enough? We have a lot of users at the same time in our web application.

And is there any additional arguments I should pass to Java?

Thank you.

OS: Windows Server 2016 (10.0) 64bit
Java Version: 1.8.0_181 (Oracle Corporation) 64bit
Tomcat Version: Apache Tomcat/8.5.33
Lucee Version: Lucee 5.3.8.206

How much RAM is assigned to your app now? Unless it’s some very small amount, am OOM is usually a sign of an actual memory leak in your application. Giving your app a bigger heap may “kick the can down the road” so to speak but likely won’t resolve it.

Generally speaking, it’s difficult to give “too much” memory to an application. if you have 16 GB on the box you could easily toss half of that at Java. But I recommend using a tool like FusionReactor to determine if your heap is growing over time and not coming back down when you run a garbage collection.

I’ve helped a lot of clients identity memory leaks through Ortus’ consulting if you need a second pair of eyes on it.

And is there any additional arguments I should pass to Java?

Not unless you’ve identified a specific problem and have a specific JVM arg to fix it. too many people copy “magic” JVM args from blogs and have no clue what they do and I’m not a fan of just pasting in stuff because it worked for someone else’s server. First identify if you have a problem and what that problem is.

We have the Initial memory pool at 256MB and Maximum memory pool at 512MB. It’s the default values we didn’t know we had to change.

Is it your question about the RAM we assigned to the app?

They may be too small. Hard to say as it depend son the app. But given you have 16 Gigs in your OS, you should defo throw a bone to the JVM and let it use much more of it. If this is a prod server, set the min and max heap to the same so it just all gets claimed when it starts up. Start with 8 Gigs and see how it behaves.

1 Like

I’m sure it’s too small for the web application we run. Lucee and this application is the main thing the server run, but it’s a transactional web application use all day long. It may have a memory leak somewhere, maybe, I will need to figure it out with FusionReactor. I take note that you offer consulting about it.

Thank you for your help! We will boost it tonight!

Hi @bdw429s,

We changed the values to 8 Gigs for the Initial memory pool and Maximum memory pool. We feel there is a memory leak somewhere, because the stats stay low a while, then go up, then never go back as low as before.

  • Day 1 : Java Heap started around 3% to 31%
  • Day 2 : Java Heap started around 12% to 42%
  • Day 3 : Java Heap started around 21% to 51%
  • Day 4 : Java Heap started around 29% to 60%

We will need to restart Tomcat/Lucee soon.

I will install Fusion Reactor in our test environment to familiarize myself with this tool. If I can’t find out the problem, I will create a new topic.

Garbage collection is tricky because the collector is lazy. It doesn’t clear memory if it doesn’t have to. That means the heap may “appear” to not come down, but if you click the “garbage collection” button in fusiorneactor, which forces a full collection, it may drop all the way down. I’d need to see the memory graphs over the course of a few days to know more. It’s common to have the “saw tooth” pattern of heap growing and then being collected a little. The question is really about the “floor” which is the lowest the heap will go back down to when you force a full collection. If that is creeping up and not coming down, then heap dump analysis will tell you exactly what is in your heap.

Thank you for the info.

I installed Fusion Reactor. I was easier than I thought. I have access to Fusion Reactor now! I feel like I’m going to have fun with this!

Is that safe to install and run Fusion Reactor on a production server? Is it a resource intensive application?

Yes, not only safe but also highly recommended!

No, it has very low overhead by design.

Here’s a couple videos to get to started with FR

1 Like