ColdFusion Memory Tracking: Real World Performance Example

It is widely known that the built-in ColdFusion Server Monitor can in many cases cause a CF server to become entirely unresponsive if Memory Tracking is enabled. I've experienced this myself when I previously consulted with customers, and I was able to save many clients that engaged me to resolve performance problems by identifying that they had inadvertently enabled Memory Tracking in production. I've written about this before, as have others.

A Test
However, as I am currently working on a Performance Testing project for an enormously large web application, I took this opportunity to observe and measure the impact of enabling Memory Tracking on performance. I was not at all surprised by what happened (the server became entirely unresponsive in very little time), but I was pleased that I was able to document the exact impact in a more empirical manner.

Environment
This experiment took place in a staging environment with 3 machines: One to host ColdFusion, another to host IIS, and a third to host JMeter. A performance test was created in JMeter to moderately exercise the application. It was run as a stress test by applying 100 Virtual Users indefinitely with 0 think time (no delay between a HTTP Response and the next HTTP Request). This means that at any given moment JMeter is making 100 simultaneous Requests to the CF server. The CF server is a virtualized instance with a max heap size set to about 12GB, sitting on Windows 7 with 25 GB RAM and 4 x 2.4GHz processors.

Let'r Rip!
The JMeter Test Plan was started and left to run for several hours, all the while pounding ColdFusion. During this period Monitoring was enabled in Server Monitor, but neither Profiling nor Memory Tracking were enabled. The CF Server's throughput was measured in Server Montitor to be steady at about 20 Requests per Second +/- 4 requests (steady range of 16-24). Memory Used by the JVM was a steady 3.9 GB at the peak followed by troughs of about 1.2 GB, with Garbage Collection happening once a minute. This created the typical sawtooth pattern when using the -XX:UseParallelGC JVM GC option. The CPU was typically in the range of 8-12% usage (across the 4 CPUs). The total throughput and memory utilization held steady for the several hours of testing. The app was performing beautifully, with 0 errors logged.

The Death Spiral
Before terminating the JMeter Test Plan execution, I enabled Memory Tracking in the Server Monitor. The JVM memory used began to quickly rise at the rate of about +700 MB per minute. The memory used jumped from a steady 4GB up to 8GB in just 6 minutes before the Server Monitor Interface stopped updating completely. Attempts to disable Memory Tracking were futile as button clicks did not respond. I could only watch the Task Manager on the CF server to continue observing memory and CPU. During the several hours of testing, total System Memory in Task Manager showed about 7.4 GB used, but after Memory Tracking was enabled and Server Monitor became unresponsive, I observed the total System Memory to be 13.7 GB, an increase of about 6 GB. The JVM was at or very close to being at the max heap allowed of 12 GB and was not able to reclaim any memory via GC. At this point I decided to kill the process tree of jrunsvc.exe (which also killed it's child process of jrun.exe, the main server instance). I stopped JMeter and then started ColdFusion again, making sure to disable Memory Tracking before running my next performance test run.

Caveat Emptor
This was a great example to see how Memory Tracking can bring a server to its knees. Often reported and well understood anecdotally, but I thought some actual screenshots of it in action would help illustrate how dangerous this setting can be. Memory Tracking can be used effectively in development and QA for debugging or troubleshooting performance issues, but only when used under small load. I should point out that sometimes Profiling is known to similarly bring down a server, but I was not able to observe any impact of the Profiling setting on this particular application as performance seemed normal when enabled during a stress test.

Server Monitor during Test
ColdFusion Server Monitor: Memory Tracking Performance Impact

[More]

Automated System Testing for Web Apps at CF.Objective

I'm excited to to have the honor of once again presenting at the CF.Objective() Enterprise ColdFusion Conference. This year I'll be talking about Automated System Testing for Web Applications with CFSelenium, MXUnit, and Jenkins.

I've been a Quality Assurance software developer since 2007 when I was on the ColdFusion server engineering team at Adobe. For the past couple years I've enjoyed working at FirstComp Insurance with one of the largest ColdFusion developer teams that I know of, including well known team members like Sam Farmer, Dan Vega, and Jason Delmore, as well as many others of ColdFusion's best.

Testing by Isolation
One of my goals last year was to create a test suite framework that could perform Automated System Testing of our collection of web applications that we use for our business. We run it all on ColdFusion with a truly massive code base, and we have many different web applications that drive different parts of the business, each with unique user interfaces (UI). Part of good development practices includes writing Unit Tests early in the project to test application modules (CFCs) in isolation. Unit Tests are great for catching issues early in the release cycle, but they don't test how all the parts work together across the whole application as a system.

Testing Across the Board
This is where System Testing (or UI Testing) comes in, and I'll be showing you how I built our automated UI test framework from the ground up.

[More]

Could not find ColdFusion component or interface Query

My best blogging years were when I worked in ColdFusion Technical Support, from Allaire and right on thru Macromedia then Adobe. Constantly fielding customer questions provided an endless source of fodder to investigate and blog about when a solution or workaround was found. It feels a little like old times again now that my QA team is expanding and I've been helping others come up to speed with our ColdFusion driven Automated Test Suite. Although my colleagues are experienced web professionals, I'm happy there is room for mentoring in ColdFusion, and that provides me with more fodder to share here.

After helping someone install ColdFusion 9.0 and apply the 9.01 updater, they reported the updater failed to complete. We cleaned things up a bit, confirmed installers, and tried again. Success. Shortly after, we continued setting up the test suite environment they reported a very unusual error that I'd never seen before, Could not find the ColdFusion component or interface Query. With a bit of Googling, I found that there were only 2 hits, and one was in a comment on Ben Nadel's blog where he provided the winning hint. The other hit was a tweet about it when someone else encountered this issue.

Per Ben's hint, I had my colleague check the CF Admin's Custom Tag mappings, and the source of the problem was immediately evident. The core mapping for "C:ColdFusion9CustomTags" was missing. Prior to then, I thought this mapping was immutable by the end user of the CF Admin. Perhaps it was due to the initial failed 9.01 updater, I'm not really sure how that mapping got wiped out, but as soon as we restored it, everything worked.

The mapping is needed because some parts of the Core CFML language are implemented as custom tags stored in that core location. This includes the query.cfc tag, which implements the script-based version of CFQuery. Without that mapping, there will be several language areas that won't work.

[More]

No April Fools: Selenium Shipped Soon to Expire SSL Certificate

QA Engineers everywhere woke up today and rolled into the office with the usual dread that Monday morning's bring, only to find out their day just got even worse because all of their selenium driven, automated test suites all came crashing to a halt on Sunday, April 1st 2012. Every test would halt with an SSL Certificate warning message "Error code: sec_error_expired_issuer_certificate".

It took me a 15 minutes of scratching my head, looking at test success history on Friday (when they all passed) and comparing that to any changes in the test suite (there had been none in the last few days). Then it hit me that that the culprit might be that darned CyberVillians' certificate that ships in Selenium. Once that dawned on me, I dug up the selenium-server-2.0.0.jar file, extracted, and checked out the cybervilliansCA.cer in the sslSupport subdirectory.

I had been using Selenium 2.0, which includes its own SSL certificate called cybervillainsCA.cer bundled into the server. It uses that SSL certificate to proxy/intercept the SSL requests to the Application Under Test. Well, apparently that cert has an expiration date of March 31, 2012, and I ran smack into it. This caused all tests to fail because Selenium could not proxy SSL anymore.

To correct the problem, I had to update the Selenium server version to 2.20, which should be good for another 20 years since they had the good sense to make it expire in 2031 this time.

The Selenium Server 2.0 Expired Certificate:


The Selenium Server 2.20 Certificate Valid Until 2031:

Multiserver Monitor: Permission Denied and crossdomain.xml

While helping out with this issue on the Adobe Forums, I learned that the ColdFusion 9 Multiserver Monitor now requires /crossdomain.xml on target servers rather than /CFIDE/multiservermonitor-access-policy.xml. I was not aware of this change, so hopefully this post will ensure that others who administer ColdFusion will be.

---------------------------

Since I was actually on the ColdFusion 8.0 engineering team at Adobe and personally tested the multiservermonitor back in 2006/7, I find it very surprising to learn that /crossdomain.xml is now required in the webroot INSTEAD of /CFIDE/multiservermonitor-access-policy.xml.

I did some testing on a couple local ColdFusion 9.01 servers, and to force the requirement of the access file, I loaded the CF Admin Multiserver Monitor over localhost (127.0.0.1) and then tried to add a different CF instance to the monitor using the other interface for the same machine 192.168.1.104. As expected, I got Permission Denied. I then went to the target server that I was trying to add, and I enabled the multiservermonitor-access-policy.xml by uncommenting the appropriate line. I was really stunned to find that the target server still showed a Permission Denied status (Figure 1).

[More]

JVM Memory Management and ColdFusion Log Analysis

The following is a document I wrote for knowledge sharing with some peers, but I feel that it might have some value to other ColdFusion Devs, Testers, and Admins out there. The purpose was to illustrate how I went about analyzing CF's performance during a prior troubleshooting session. I'm re-purposing the content here after scrubbing some private information. Hopefully it still makes sense, although slightly out of context.




These are some technical notes on what to look for when analyzing ColdFusion server performance history. It includes concepts and techniques to assess what performance related problems might exist, emphasizing memory usage issues first. This is a somewhat simplified explanation about how the JVM manages memory and its relation to CF applications, and about how I went about analyzing them. There are many similar resources on the web, but I found many of them are quite technical, so this article is written with more of a layman's approach to make it more digistible to those not as familiar with troubleshooting ColdFusion or Java apps.



The ColdFusion Application Server runs inside (is "contained" in) a higher level JRun J2EE server. The J2EE server (and therefore the CF server) run on top a JVM (Java Virtual Machine). To analyze the ColdFusion and JVM performance, I take a forensic approach. I start by collecting the ColdFusion and JRun server logs. I also colelct the JVM Garbage Collection (GC) log that has been manually enabled to log information regarding how the JVM is cleaning up the memory that is has used. The JVM is configured with an algorithm that tells it what approach to take when cleaning up and freeing memory. The application's Java objects (like queries, session variables, local variables, cfc instances, etc) are held in the JVM's memory. Objects are said to hold "references" in memory, meaning that something in the application is potentially using that object. When the application no longer has a need for an object, its memory is dereferenced. That dereferenced memory can be released by the JVM and then reused by other objects that require it.



[More]

ColdFusion 9.01 Server Monitoring Enhancements

I began this thought as a comment to Adobe CF QA engineer Sagar Ganatra's blog entry describing the new Server Monitor enhancements in ColdFusion 9.01 updater, however, as it grew lengthy I decided my own blog post would be a more appropriate venue.




I'll add that the main reason for why one would want to run the ColdFusion Server Monitor on its own port via the Jetty implementation is that until now requests from the Server Monitor would go through the JRPP request pool, thereby adding additional traffic to the JRun active request pool, but more importantly if the JRun active request pool was queuing then the data refreshes in the Server Monitor would also queue and the Server Monitor may appear to hang as well. By establishing a separate request pool and port for Server Monitor requests in ColdFusion 9.01, the Server Monitor will not encounter a blocking situation as it would do previously.

Any general discussion of the Server Monitor should include the caveat that the use of Profiling, Monitoring, and Memory Tracking are not intended for production use (blanket statement: see comments for more on that). Moreover, if Memory Tracking is enabled in production, perhaps to help diagnose a prod performance problem, that it will only further decrease server performance. On 3 occasions in the last year alone I've helped ColdFusion shops that shot themselves in the foot by doing this. The impact to performance was substantially worse when enabled, and having them disable it immediately alleviated most of the problems, albeit not the problem that initially prompted them to enable the tracking.

Nice enhancements to Server Monitor in the future might include:
  • Persistant Metrics: The ability to persist the Server Monitor data to a database. A restart of CF will clear data as of now. A use case would be for load testing scenarios where the a a variety of metrics need to be quantitatively analyzed, which cannot presently done easily. Ideally, you'd want to know performance metrics at different points into a load test such as during the ramp up, after X minute intervals, and during cool down.

    A second use case would be the ability to produce reports to monitor server health over time, perhaps by providing the ability to generate weekly reports of key data, possibly with green and red arrow indicator to visually identify metrics that have improved or worsened.


  • CF Request Pool Ratios: Add the ability to analyze incoming requests to determine the real time ratio of CF request types such as CF Templates, CFCs, Flash Remoting, and Web Services. When expressed as a percentage, it could used to correctly determine the values to use in the Request Tuning part of the ColdFusion Administrator. Throughout much of my experience I have found that CF shops rarely set the Request Tuning values to an appropriate range, either letting them remain unchanged at the default, or increasing them way out of range (into the hundreds even).


  • Request Tuning Calculator: Provide a real suggested starting point for all Request tuning parameters including the JRun active and queued sizes based on the number of CPUs/cores and processing speeds. Presently, even in CF 901, a server will install with a default set of values that will the same on a small box as it would on a beefy production box. To do this correctly, the total number of instances used to process production load would also have to be incorporated for proper per-instance tuning. Having a Server Monitor Request Tuning Calculator would be a big plus towards helping server admins find the right starting range for their particular hardware.


  • Out of Process Memory Tracking: Since Memory Tracking is known to consume significant resources while tracking (a Heisenberg conundrum?), perhaps Memory Tracking could be done out of process over RMI or similar, akin to the JRockit Mission Control memory analyzer (which I've used for ColdFusion, but interpreting the data is not very intuitive).

Starting ColdFusion9 Solr: Using cfsolr in same directory

The cfsolr script for Mac, Linux, and Unix is written such that you must be in the ColdFusion9/solr/ directory when running the script. The script refers to the start.jar file without providing the full path.

The problem is that if you are not in the solr/ directory under the ColdFusion root directory, the cfsolr script echos that Solr has been started or stopped, even though it has not.

Since the standard error is redirected to the standard out with "2>&1" the problem is swallowed and the person performing the operation is led to believe that the operation has been carried out as expected.

Here's a snippet from the ColdFusion9/solr/cfsolr script showing that start.jar is referenced without a full path:

view plain print about
1SOLRSTART='nohup java $JVMARGS -jar start.jar > $SOLR/logs/start.log 2>&1 &'
2SOLRSTOP='nohup java $JVMARGS -jar start.jar --stop > $SOLR/logs/start.log 2>&1'




Looking at the logs, I see that the problem was quietly recorded in a solr log file:

view plain print about
1QAs-iMac:logs QA$ pwd
2/opt/ColdFusion901/solr/logs
3QAs-iMac:logs QA$ cat start.log
4Unable to access jarfile start.jar




The script already has a variable defining the Solr directory path:

view plain print about
1SOLR="/opt/ColdFusion9/solr"




To fix the bug, prefix the reference to start.jar with ${SOLR}/start.jar like this:

view plain print about
1SOLRSTART='nohup java $JVMARGS -jar ${SOLR}/start.jar > $SOLR/logs/start.log 2>&1 &'
2SOLRSTOP='nohup java $JVMARGS -jar ${SOLR}/start.jar --stop > $SOLR/logs/start.log 2>&1'




With that fix, the cfsolr script can be called from any directory outside the solr directory.

Here is an examle of how the script falsely echos that the solr server has stopped or started when it has not (determined by grepping for the process):

view plain print about
1QAs-iMac:opt QA$ pwd
2/opt
3QAs-iMac:opt QA$ ./ColdFusion9/bin/coldfusion stop
4Stopping ColdFusion 9, please wait
5Stopping coldfusion server.stopped
6ColdFusion 9 has been stopped
7QAs-iMac:opt QA$ ps -ef | grep solr
8 501 73310 1 0 0:00.25 ?? 0:02.64 /usr/bin/java -XX:+AggressiveOpts -XX:+ScavengeBeforeFullGC -XX:-UseParallelGC -Xmx256m -Dsolr.solr.home=multicore -DSTOP.PORT=8079 -DSTOP.KEY=cfsolrstop -jar start.jar




view plain print about
1QAs-iMac:opt QA$ ./ColdFusion9/solr/cfsolr start
2Starting ColdFusion Solr Server...
3ColdFusion Solr Server is starting up and will be available shortly.
4QAs-iMac:opt QA$ ps -ef | grep solr
5 501 78371 62961 0 0:00.00 ttys000 0:00.00 grep solr
6QAs-iMac:opt QA$ ps -ef | grep solr
7 501 78373 62961 0 0:00.00 ttys000 0:00.00 grep solr
8QAs-iMac:opt QA$ ps -ef | grep solr

Adobe LiveCycle DataServices for ColdFusion at CFObjective

Allaire's CEO, David OrfaoAfter a decade of working intensely with the ColdFusion server, I'm finally getting the courage to start presenting about it on the conference circuit. As a blogger, tweeter, and contributor to mailing lists I'm very confident helping others solve ColdFusion related problems because I can do that from the quiet comfort of my own desk. However, one of my greatest fears has always been public speaking. I'm the kind of person that feels like I need to know the subject matter cold, so that I can speak from the hip without relying on looking at the slides.




Blackstone Test CDsOver the years, I had some opportunities to present to small groups, and I recall each time feeling the adrenalin surge and my heart pounding. That started with presenting ColdFusion for Unix and Linux as an internal training class at Macromedia. Later, while taking classes at the Harvard Extension School, I was honored to be asked to present to CSCI-253 Developing Web-Based Database Applications. Even more so, I presented twice there in one year. The first time on Building ColdFusion Web Applications with CFEclipse and Dreamweaver, and later on ColdFusion Server Administration




MAX in ActionI've been attending ColdFusion conferences since the days of Allaire DevCon, but had never presented at any of them including MAX. My long time friend in the local ColdFusion Community, Brian Rinaldi, continued to encourage me to present at the local Boston CFUG as a starting point, as well as the new conference that he was organizing, RIA Unleashed, held in Bentley College this past November. The members of the CFUG were kind enough to let me present a draft of a presentation that I was to later give at RIA Unleashed. My presentation topic was Adobe LiveCycle DataServices Data Management for Mere Mortals


ColdFusion 1.5 on Floppy DisksFortunately at RIA Unleashed I was among the very first sessions after the keynote, so there was no time to build up butterflies that morning. If beforehand you would have told me that among the audience front row would be Ben Nadel, Simon Free, and Ray Camden with Tom Jordahl tucked way in the back then I surely would have freaked out. But they were both kind enough to chat with me before hand and even lend some technical assistance getting setup with the A/V, so that really put me at ease. With a firm limit of 50 minutes, I pushed all the way through what should have been a 90 minute talk, all the while trying to remember to speak clearly and loudly. The talk went off pretty much without a hitch as I found myself completely focused on the technical content and not at all worrying about the large room filled with people in front of me. I was delighted at the end when Tom complemented me on talk, which to me was the ultimate satisfaction.




First Unix machine to run ColdFusionI chose LCDS for ColdFusion as a topic because while I was a QA Engineer on the ColdFusion team at Adobe, I was paired with Tom, a Computer Scientist at Adobe who architected the integration between the products. Heck, Tom architected much of ColdFusion itself, and was in fact the original engineer to have ported ColdFusion to run on Unix and Linux back in the day. Tom is a font of information, and I cut my teeth on the feature under his guidance, which was then known as Flex Data Services and later renamed under the LiveCycle brand. I spent many days last summer and fall revisiting all the LCDS documentation again to ensure the quality of my presentation and to mentally prepare me for the upcoming conference.




ColdFusion Team, BangaloreWIth my first conference under my belt, I decided to throw my hat into the ring for the ultimate ColdFusion experience, CFObjective, which is promoted as The Only Enterprise ColdFusion Conference. I'm excited to announce that I have been selected to be a speaker at the conference, which runs from April 22-24th in Minneapolis, Minnesota. The conference is divided into three tracks for technologies related to ColdFusion. I'll be speaking the last day in the Flex track, once again on the topic of LiveCycle DataServices for ColdFusion Developers. Specifically I'll be talking about the prime feature of LCDS, the Data Management capabilities. With any luck I'll be updating my presentation to consider the benefits of working with the latest versions of Adobe software. Here's the brief description and the PDF:




Discussions of Adobe's LiveCycle Data Services are often entered with the same trepidation as those of Organic Chemistry or Quantum Mechanics, but with ColdFusion, building Web applications that manage complex data sets doesn't have to be that scary. Data Management is a pillar of LCDS that offers scalable, real-time data synchronization across very large numbers of connected clients with the benefits of conflict resolution and data pagination.† Come learn how to quickly get up to speed with Data Management by letting ColdFusion do the hard work for you.


If you're seriously interested in ColdFusion, then CFObjective is the conference for you. I hope to see you there.






ColdFusion Screams

Is Your ColdFusion Support a Real Turkey?

Are you getting half baked help solving complex server problems? Is your global service provider a little off? Sure, maybe its a lot off.

Webapper wants your feedbag feedback about what's important to you. Take this survey to let us know what you really want from ColdFusion support, and the first 100 respondents win a copy of SeeFusion Enterprise, a ColdFusion bottleneck analysis tool with all the trimmings.

Webapper's consulting practice is a one-stop shop for all of your ColdFusion support needs. Our service offerings have been developed and honed over many years, and through hundreds upon hundreds of successful engagements, and they deliver a full spectrum of expertise that covers the entire "Web application stack".

Webapper's consulting services practice is a world leader in ColdFusion support expertiseour engineers are all former employees from the consulting, support and engineering teams at Allaire/Macromedia/Adobe.

More Entries