Tuning The Java Application Server - ColdFusion Using Native Tools

Jul 08, 2017

This will be the first in a series of detailed ColdFusion articles based on 16 years experience of installing, tuning and troubleshooting ColdFusion from version 4.0x through to ColdFusion 2016 (the current version).  In fact I started as a developer in ColdFusion at version 1.54 back in 1996 if I recall that year correctly.

Over these 20 years there have been three major changes, the original version up to version 6 had a C++ core engine, at version 6 ColdFusion was ported to a Java core, which it still has, running on Sun 1.3x JVM.  The underlying Java Container was JRun which came from a company called "Live Software", which the creators of ColdFusion "Allaire"; had purchased earlier on.  The next big change was at ColdFusion version 10, when the current custodian of ColdFusion, Adobe, moved it to running on Tomcat.

The last major change in ColdFusion evolved over time and there are now two complete versions of ColdFusion; the original which is tag based and also a full version in script.  I thought this potted history was worthy of sharing; now let's get into the detail of this post; this will be a long and detailed blog post and I will apologize if some of the images are hard to read because of re-sizing them.

This article is based on the core elements which come with both the Standard and Enterprise versions of ColdFusion, so there are no extra costs needed, to do what I am detailing here and it will be very useful to you.  In other words these are core ColdFusion capabilities, the first section will show what we can do to set up the basic needs to get the enhanced logging and reporting running.  All these settings can be run safely in production.

ColdFusion Server Monitor Administrator Settings

This is the entry screen for the ColdFusion Server Monitor and here we are selecting "Enable Momitoring" and "Enable Profiling"  but not "Enable Memory Tracking" which is not suitable for production systems.

ColdFusion Monitor

ColdFusion Server Monitor

After selecting what we want to see and monitor; we launch the ColdFusion Server Monitor.

ColdFusion Server Monitor

ColdFusion Server Monitor

Once Server Monitor is launched we see this "Overview" screen which is a real-time view of how your ColdFusion server is performing at this time.  The top two segments show Average Response Time and Requests Per Second, respectively.  In the middle section we can see on the left "Reports" and in there a series of metrics on Requests, Sessions, Queries and JVM memory.  The middle right area shows Slowest Active Requests.  The bottom left shows any Alerts and the bottom right the Last Error.

ColdFusion Server Monitor

The next section in the Server Monitor is Statistics, we are looking here at the Active Sessions during a lab load-test.  More importantly what this shows us is that the ColdFusion Server Monitor has a tremendous amount of useful information for us and is very useful and it gets even better, as we shall see.

In the same area here we see information on Template Cache Status which is an important performance metric, The Template Cache is almost always under-sized.

ColdFusion Server Monitor

Here we are looking at JVM Heap Memory behavior, again this is during a lab load test, we shall see more on JVM memory later in this post.

The next section relates to creating Alerts, which is probably the most powerful part of this very powerful, useful tool.  Alerts can be reported in two ways; as Snapshots and also as Email.  In this part we will concentrate on Snapshots which are incredibly detailed and useful; probably the most useful body of ColdFusion performance and troubleshooting information anywhere.  Strangely enough, it is hardly used.  This is the first Alert we will set; Unresponsive Server and what I am showing here are recommended settings based on experience which can be adjusted at any time.

The next setting is Slow Server and once again these are recommendations based on my experience.

ColdFusion Server Monitor

This recommendation is based on the default JVM maximum Memory size of 512MB and should be adjusted as we tune the JVM.

ColdFusion Server Monitor

This area creates Snapshots for Request Timeouts, again this is my beginning recommendation and can be adjusted as needed.

JVM Tuning

Myself along with many others have posted on JVM tuning, so all that I will show here is setting up JVM logging which I recommend be enabled and left on at all times in production also because the logs created are small yet tremendously valuable during performance challenges.  These settings are for the 1.7x and 1.8x Oracle JVM, we add these arguments after the -server argument in C:\ColdFusion2016\cfusion\bin\jvm.config

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=3 -XX:GCLogFileSize=10240k -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -verbose:gc -Xloggc:cfwhispererGC.log

This will create a rotating archive of the Garbage Collection (GC) log named cfwhispererGC.log in the C:\ColdFusion2016\cfusion\bin\ as follows

JVM Logging

I use a great utility called GCViewer to analayze the resulting GC logs, this can be downloaded here.  Here is an example GUI view of the GC logs.

JVM logging

CFSTAT

CFSTAT has been around a long time and is yet another way to monitor ColdFusion, it has its place.  It is easy to enable and view and shows us other metrics not so easy to find elsewhere and like all else in this article is bundled free with ColdFusion.  Metrics logging is another great utility and here is how to enable these in ColdFusion Administrator, in the Debugging and Logging section.  The important part here is the Connector Port which needs to be set to the internal port of the external web server which can be found in the C:\ColdFusion2016\cfusion\runtime\conf\server.xml in this entry.

<Connector port="8016" protocol="AJP/1.3" redirectPort="8447" tomcatAuthentication="false" />

This is what CFSTAT output looks like in the terminal.

ColdFusion CFStat

In the JRun based implementation of ColdFusion, Metrics Logging was the most powerful logging option that is used many times to trace problems, usually by following either requests hanging, JVM memory dropping or gone or both.  I would take note of the date-time stamp of the problem and then look across all other logs to pinpoint the cause.  It has taken me till ColdFusion 2016 to get Metrics Logging working correctly again.  The setting is here in ColdFusion Administrator, Debugging and Logging.  The key is the port number as mentioned above.

The metrics.log will be created in the C:\ColdFusion2016\cfusion\logs directory and as with CFSTAT shows Request-Thread and JVM memory snapshots which as mentioned above, I use to zoom in on performance problem causes by timeslicing across other logs.

Conclusion

In this blog piece I have gone through tools and utilities which are available to us all, in ColdFusion without adding any third-party utilities, which can be used to troubleshoot many ColdFusion problems as they arise and pinpoint their causes.  In addition they can also be used in formal testing and capacity planning to avoid performance problems in the first case.  I hope to follow this up with the use of third-party tools for the same purpose.

About Mike Brunt

Mike has been working since 2001 on all things Java server-side. This includes, troubleshooting, tuning and infrastructure design, engineering and migration. More ...

Categories

Monthly Archives

Favorite Links

Tag Cloud

java jvm java containers capacity planning load testing internet of things android

Feeds