Accessibility

Table of Contents

Performance tuning for ColdFusion applications

Case study: BlogCFC

To show how much performance can be improved by using the tips covered in this article, I used BlogCFC as a case study. The performance gain noted here is specific to the BlogCFC application for a particular system configuration.

Preliminary tasks

I began by installing GCViewer on a machine with ColdFusion server and installing JMeter on a separate machine that will measure performance. For JMeter and GCViewer to work effectively they should be on different physical machines, preferably on different switches.

In JMeter I recorded a test case that navigates across different pages of BlogCFC. (For more information on how to record a test case in JMeter see JMeter proxy step-by-step.)

Initial profile

Before I tuned anything, I obtained an initial profile to determine the current performance level. I used GCViewer for the profiling and JMeter to measure performance. Initially, all the settings for ColdFusion Administrator and the JVM (as specified in jvm.config) are at their default values. To have GCViewer profile garbage collection, I added the following line to jvm.config under "Arguments to VM" and restarted the ColdFusion server:

    -Xloggc:C:/log.txt  -XX:+PrintGCDetails  -verbose:gc

GCViewer now logs profiling data C:\log.txt.

Figure 10 shows the profile for 30 virtual users (from JMeter) running for 15 minutes accessing pages of BlogCFC. The yellow area represents the young generation and the purple area represents the tenured generation. Blue lines represent used heap.

This profiling shows that there are frequent major collections and frequent minor collections.

The initial GCViewer profile of BlogCFC

Figure 10. The initial GCViewer profile of BlogCFC

The initial average response time (ART) and throughput data collected from JMeter is shown in the following table:

ART(ms)

Throughput/sec

118

251

Turning Trusted Cache on

As a first tuning step, I turned Trusted Cache on and noted the following improvement in performance:

ART(ms)

Throughput/sec

105

283

Increasing the heap size

Next, I increased Xmx (the maximum Java heap size) from 512m to 1024m to reduce the frequency of major collections (and thereby improve performance).

In the profile shown in Figure 11, you can see that the frequency of major collections has decreased.

The profile after increasing the maximum
heap size

Figure 11. The profile after increasing the maximum heap size

And the performance did improve:

ART(ms)

Throughput/sec

93

316.7

Allocating space for the young generation

In the initial profile (see Figure 10) I noticed that the young generation consumes around 35% of memory. This prompted me to increase the Xmn value to allocate more space for the young generation and reduce the frequency of minor collections.

To increase the Xmn setting from its default to 512m, I added the following to jvm.config:

-Xmn512m

For an application with lower young generation requirements, you might try using a smaller value for Xmn, for example:

–Xmn256m

The profile after allocating more heap to
the young generation

Figure 12. The profile after allocating more heap to the young generation

Figure 12 shows that the frequency of minor collections decreased, and the performance metrics show that performance improved:

ART(ms)

Throughput/sec

89

330.4

Because this application showed significant young generation usage, I decided to tune the survivor ratio to see if it would provide any performance gain. The results below (measured after this change) show that no improvement was made:

ART(ms)

Throughput/sec

89

330

Saving client variables in cookies

Next I tried another ColdFusion Administrator option, saving client variables in cookies instead of in the Registry (the default). This resulted in further improvement:

ART(ms)

Throughput/sec

78

372

Overall improvement

Throughput improvement for various
tuning steps

Figure 13. Throughput improvement for various tuning steps

Figure 13 shows that there is a 48% increase in performance in total for BlogCFC using the tips covered in this article.

Where to go from here

Download GCViewer and Jmeter and start profiling of your ColdFusion applications.

Attributions

I would like to acknowledge the help of the following people and resources that contributed to this article:

  • Manjukiran Pacchhipulusu, Lead Software Engineer, ColdFusion product team
  • Rupesh Kumar, Computer Scientist, ColdFusion product team

Articles: