ColdFusion Performance Issues and Troubleshooting

FusionReactor 8.6.0 Released
Black Friday Deals

With ColdFusion being one of the most powerful and robust Java development platforms for web application development, it does not automatically eliminate the presence of certain parameters that could lead to a performance issue on a ColdFusion server. 

You’ll find out more about the ColdFusion performance issues and troubleshooting in the other part of this article.

What Is ColdFusion?

ColdFusion is a commercial Java-based web application development Server introduced in 1995. The original intent for creating the ColdFusion Java computing platform was to connect basic HTML webpages to a database or server easily. 

Within a year, the beta version (II) was launched as a complete platform. With the inclusion of an in-house IDE (Integrated Development Environment) and scripting language known as ColdFusion Markup Language (CFML). 

The ColdFusion’s multiple utilities include generating remote services like- REST, SOAP web services, Flash remoting, or WebSockets

ColdFusion is also used for data-driven intranets, websites, and web applications. It fits a server-side technology to client-side ajax – since ColdFusion handles asynchronous events. Things such as SMS and instant messaging through the gateway interface is made accessible in the Macromedia ColdFusion MX 7 Enterprise Edition.

Common Causes To ColdFusion Performance Issues

Issues related to performance are one of the biggest snags encountered during the design and implementation of web applications. Problems such as website crashes, CPU hikes, delay in process thread, Memory leaks, Error 503, Network Latency, etc., cause both short and long-term revenue loss.

I) CPU Surges

Failure to perform load and performance tests could result in the inefficient running of the ColdFusion platform to quickly detect the impact on the existing CPU utilization. Some of the major causes of CPU spikes are;

Out of Memory Issues

The frequency of CPU spikes can be tracked in the ColdFusion logs for OutOfMemory entries. Two basic scenarios could result in such surges. The OutofMemory issues occur when the Garbage collector cannot claim memory – due to persistent reference to stale objects or on the CPU thread.

  1. OutofMemoryError: Heap: – The heap (OutOfMemory) surge occurs when a much lower value of the heap than the actual usage results in a much slower response rate within the Java Virtual Machine (JVM). In addition to the application usage exceeding the upper limit provided. By your application memory usage, you can solve the OutofMemory: Heap problem by updating the maximum heap size. You can change this value in ColdFusion’s Administrator dashboard or visit: JVM.config (ColdFusionXXXX/instance_name/bin).
  2. OutOfMemoryError: – Given the latest version of the Java Software development environment – Java 1.8, comes the introduction of a new flag known as the MaxMetaspaceSize. This allows you to limit the amount of native memory been utilized for class metadata. By convention, all class metadata allocations are restricted to the amount of native memory available. But in recent times, most of the slots allocated for the class metadata in a metaspace environment have been allocated outside of native memory. Once the class metadata raises the “MaxMetaspaceSize” error, garbage collection of those expired classes and classholders are then triggered.

To limit the frequency or delay of the garbage collection process, adequate monitoring and tuning of the Metaspace are essential.

Slow Database Query Thread

All of the logs generated by ColdFusion – Application logs, Exception logs, and error logs, help the platform identify slow queries, when a query times out or not, and then fixes them. If a ColdFusion server is running slow or when a query execution is taking too long, this signals a problem with either the Application or code. At which point, high rates of website desertion become imminent. Reduced user engagements can result in an increased loss in revenue, hence, affecting your bottom-line. Slow applications may be due to a variety of issues in your application codebase and how the servers were being configured.

ColdFusion terminates all connections after such timeouts. It then recycles the cache for idle or unresolved connections – these idle connections would be reused when required.

Network Wait-time

Network latency amounts when the application codebase is located in a shared drive within the ColdFusion environment. Most servers crash and slow request processes are also affected by network latency. As a rule of thumb, it is always recommended to check your local network throughout. Querying a ColdFusion database may be impeded by a variety of factors. Unavailable service errors are one of them. 

To speed up the processing of your ColdFusion Markup – CFM, pages on a network or shared location, add the following commands to the JVM config:

-Dsun.io.useCanonPrefixCache=true

-Dsun.io.useCanonCaches=true. 

Note: The default timeout is 30 seconds.

The above instruction activates the dedicated cache that stores the established path to the file. This maneuver comes in handy in the events that there are lots of threads awaiting the attention of WinNTFileSystem – to be allocated a path. While trying to gain access to files from a shared network server, every “getCanonicalPath” command is redirected to the network. Making them all an expensive task to handle. Therefore, enabling the canonical cache establishes a simple fact; for the same file, the JVM does not need to go back to the disk to find its path. Since it already exists in the cache.

Random Number Generation

The Linux number generation often exerts a toll on the CPU on most Unix platforms. One contributing factor to the random generation and server startups being slow is that the “/dev/random” command. This is used on Unix platforms to generate a number randomly.

To eliminate performance issues due to random number generation, you can add the following code to the config:

-Djava.security.egd=file:/dev/./urandom

Garbage Collection

Excessive Garbage Collection – GC is often caused by extra load on a server – which is also the primary causative agent to CPU spikes. There are four major types of garbage collection mechanisms in Java 8 – Parallel Garbage Collection (-XX:+UseParallelGC), G1 Garbage Collection (-XX:+UseG1GC ), Serial Garbage Collection (-XX:+UseSerialGC), and CMS Garbage Collection (-XX:+UseConcMarkSweepGC).  ColdFusion employs the Parallel Garbage Collection techniques as its default convention for Garbage Collection.

For detailed information and real-time tracking of out of memory errors or memory leaks, you can perform a heap dump analysis. Do this by adding the following JVM arguments in the JVM config to obtain the heap dump: –

-XX:+HeapDumpOnOutOfMemoryError

XX:HeapDumpPath= <path_to_dump_file>

You can run the below commands directly from the ‘\jdk\bin’ directory – if you have JDK installed: jmap -dump:format=b,file=dump.hprof, given that, PID is the ColdFusion process id.

II) Application Thread Dumps

Server crashes often emerge from many unrelated issues in the ColdFusion server, Java Virtual Machine SQL database, or Operating System. ColdFusion thread dumps are mainly used for analytical purposes. Those such as evaluate; recent, executable, pending, blocked, time_waiting, and running threads on the ColdFusion platform.

Other performance-related issues like GC or OutofMemory exceptions, deadlock, hang IO calls, infinite loop, etc., can all be tracked using the thread dumps. 

If you run the ColdFusion update 12 (2016 release), use the takethreaddump.cfm file to monitor the thread dump. Also, if the performance is in any way affected by XML parsing, then the following JVM argument can fix it:

-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true

Other notable causes of ColdFusion performance issues include; Excessive logging and data caching, Inefficient SQL tuning & capacity planning, Application-specific performance problems, Service availability error, Lack of proper data caching, etc.

Whether it is a ColdFusion Emergency – CF, crashing server, or a slow CF application, professional server monitoring & tuning software suites like FusionReactor offers a streamlined approach. Designed to foster quicker resolutions of ColdFusion performance array of Servers & Application related problems. FusionReactor is the major distributor of ColdFusion results. Reporting information that comes in handy during the isolation of specific and related issues. Also, you can use the FusionReactor Memory profiler to help spot memory leaks, and review heap dumps.