Contact Us Today!   |   + 1 (301) 424 3903



Tuning CF 8.0.1 64 bit

Recently we worked on an application for a large association in DC that generates about 60% of the association's revenue. The application had grown in features and users over several years and the code was in need of tuning, with slow performance and frequent server crashes. It was running on CF 7 on Linux.

Improvements

We recently helped setup the development server with a 64-bit operating system, and the 64-bit version of ColdFusion 8.0.1. Additionally, we also did performance and memory tuning.

CF8 itself has been shown to have better object creation performance as well as general speed improvements across the board (see Adobe’s performance brief www.adobe.com/products/coldfusion/pdfs/cf8_performancebrief.pdf). We tuned JVM configuration parameters (memory and garbage collection), recommended and helped setup the updated Java runtime 1.6 updater 12, which fixes a major performance bug and allowed us to take full advantage of CF 8’s and Java 1.6’s performance and memory improvements. We even discovered CPU and memory issues that were fixed by applying a cumulative hotfix for ColdFusion.

The result of all this is much more manageable CPU and memory usage, as well as better initialization and search performance. Furthermore, many cases of CFC methods that were missing var scoping on local variables were fixed; this affecting stability and performance.

Maintainability

Here we added Application-level service objects to Coldspring, to make the code more maintainable. We also had Coldspring create more of the sub-objects, to make the object hierarchy more visible.

Generally, where these service objects called global objects directly (configuration or other service objects), changed to pass those in via the Coldspring configuration. Many places were able to reduce to passing in specific configuration properties (like a DSN), rather than passing in the whole object. This goes a long way towards reducing interdependency, which makes them better able to test.

We removed some reserved words in method names, so we could use automatic CFC documentation tools. We also had consistent use of init() methods; adding to objects that didn’t have them, and then using consistently when creating. This better enables use of Coldspring, and makes usage overall more readable.

We then made a switch to Fusebox 5.5, which allowed us to move customized code out of the core files, and into the index.cfm, which calls it; this included application-specific parameters retrieved from configuration or CGI variables. This will make it much simpler to swap out the framework for later versions.

Scalability

Finally, we developed and ran a profiling tool, which temporarily modified all of the components to save logging information on when objects are created and methods are called. We ran on some sample searches, logged the number of times objects are created and methods are called. We were then able to reduce use of some classes used in application.

There was one class that was created 160 times for each search result page that we were able to convert to a structure generated by a service object; this service object only needs to be created once per session, saving a whole lot of object creation.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Jim Stout's Gravatar So when you upgraded the JRE to Java runtime 1.6 updater 12, did you install the 64bit version or the 32 bit version? Any problems with the 64bit install?
# Posted By Jim Stout | 6/9/09 6:23 PM
David Lakein's Gravatar It was the 64-bit JRE.
We worked with the customer's Linux admin to install the JDK, then set the java.home to that JRE folder. No real issues.
(The only issue after that was CPU and memory issues, fixed by the CF8.01 cumulative hotfix 2 - http://kb2.adobe.com/cps/403/kb403781.html )
# Posted By David Lakein | 6/10/09 1:23 PM
David Lakein's Gravatar Further notes about the 8.0.1 CHF 2 :
This fix was probably issue ID 72641: "Fix for memory leaks with CFCs stored in memory scopes. Note, this does not eliminate need for proper use of VAR scope in CFC methods. "

The issue we were seeing before this CHF was CPU pegged near 100%, and memory constantly increasing. Setting full garbage collection every 10 minutes only brought it down temporarily, exactly at those 10 minute intervals. (Ajay's trying to find those FusionReactor graphs, and will post those if we can find.) 8.0.1 CHF 2 brought CPU back to normal, and memory usage had the normal spikes and reductions as local vars went out of scope. (we had already worked with them to var scope all their components)

Also, these post-8.0.1 CHFs really should be on the updaters page, like the 8.0 CHFs. Kind of confusing.
http://www.adobe.com/support/coldfusion/downloads_...
# Posted By David Lakein | 6/10/09 1:31 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner