Recommendations for Lucee JVM / Server Tuning on AWS

Good afternoon, I have been running some form of self-taught CFML for 20-ish years as a hobby and have always done enough to get by. Years ago I moved from an old-laptop-in-the-closet server to a cloud-based Ubuntu server in AWS’s Lightsail platform. So far it has been mostly very successful for my needs.

Lately I’ve been curious about tuning the JVM to be most efficient with my server. I read through what comments I could find online, including those in this thread. But I can’t seem to get a good picture of what to adjust.

I am curious if anybody could be so generous as to offer advice on the best configuration for me. Presently my virtual server’s specs are:

2GB RAM
1vCPU (Intel Xeon x86_64)

At present, my config line for the JVM in /etc/default/tomcat8 is:

JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -XX:+UseConcMarkSweepGC"

I tried to use this config:

JAVA_OPTS="-Djava.awt.headless=true -Xms1024m -Xmx1024m -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"

But it seemed to have slowed response times down, rather than improving them.

I am sure this is a silly question, but I appreciate anybody who can take some time to help me learn more. Thank you kindly.

I don’t see any reason why that would slow response times. It was likely unrelated to those settings. If there is a page you think is slow, use tool like FusionReactor to profile why it is slow. As long as you leave enough RAM for your OS and other services, you should be fine.

What JVM are you running? The reason I’m asking is because this is important knowledge for understanding what the default behaviour of your JVM would be if you did nothing.

Some general comments:

  • 1 vCPU and 2GB RAM is not a lot in JVM terms.
  • Neither a 512m or 1024m heap is a large JVM heap.
  • ConcurrentMarkSweep is suited well for large heaps (min 2GB, but ideally 4-8GB+) because it avoids long GC pauses by doing garbage collection concurrently.
  • The tradeoff with ConcurrentMarkSweep is higher CPU load (well, because it has to do cleanup concurrently all the time).

As a result:

  1. With a 512/1024 heap, I would not expect these long-ish GC pauses to occur in the first place.
  2. Given that you only have 1 vCPU you’d probably feel the overhead of ConcurrentMarkSweep more than usual.

I partially agree with @bdw429s in that it’d be more likely that your performance issues you noticed came from another source. But that being said (not knowing your application and what it’s doing), I personally wouldn’t use CMS in this setup and I think that if anything, it’d be detrimental to your performance.

1 Like

I believe I am using Java 1.8.0_282 (Private Build) 64bit, at least according to my Server Admin page. But I’m unsure how to look up the current build. This kind of back-end stuff is all very new to me, and I appreciate the responses.

I’ve removed these attributes from the config file, have restarted, and will see what happens.

-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode

Just to add more info: removing -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode increased page response time by about 10-15 percent.