cf.Objective() 2008

Viewing By Entry / Main
December 5, 2007
Some people have been noticing dramatically slower application startup times on ColdFusion 8 compared to ColdFusion MX 7. I've seen a lot of complaints about shared hosting systems where applications timeout. Since CF8 is so much faster than CFMX7, you might wonder why application startup times can be so much worse.

The answer is Java 6. For all the other performance improvements and increased functionality in Java 6, it introduced a bug in the class loader that causes substantially slower class loading. You can see a discussion of the problem on Sun's forums.

I rolled my Mac back from Java 6 Developer Preview to Java 5 and noticed a huge difference: an application that took six and a half minutes on Java 6 to start from cold, on a server with no class files in cfclasses, took around 50 seconds on Java 5.

You're only going to see this on applications that cause a large number of classes to be loaded at startup, i.e., framework-based applications that rely heavily on CFCs. You actually suffer the slow class loading on all applications but it's particularly noticeable on framework-based apps, especially ones that use Transfer (due to the high number of class files generated).

My recommendation for the time being is to ensure you are using Java 5 to power ColdFusion 8. On a Mac that's easy because Java 5 is the default JDK and CF8 automatically uses it. On Windows and Linux, you'll need to download and install the Java 5 JDK and then change your environment variables so that CF8 picks the right JDK (start CF8 from the console and you can easily see what JDK it is using).

Adobe are aware of the issue (in fact, they pointed us at the discussion on Sun's forums).

Comments

I've had problems invoking webservices with CF8 using Java 5 on my Mac. I use webservices on a daily basis, so I was forced to upgrade to Java 6. Has anyone else had the same problem? I found a solution here http://www.petefreitag.com/item/652.cfm

I haven't noticed a significant difference in the startup time though, but I'll take your word for it :)


It took Mark a little longer to write up, but some good additional details here:

http://www.compoundtheory.com/?action=displayPost&ID=270


Does it mean that the server version of CF8 on Windows and Linux ships with Java 6 as default JVM?

I haven't upgrade to CF8 yet ...

Thanks.


Could you please give instructions on how this can be done on Windows XP


"On Windows and Linux, you'll need to download and install the Java 5 JDK and then change your environment variables so that CF8 picks the right JDK..."

Which will involve updating the java.home line of ColdFusion's jvm.config file to point to the new Java 5 install. Thanks for tip Sean, for some reason I was under the impression CF8 had shipped with 1.5.


Great post, thanks Sean - do you have any reference pointers (online documentation, for example) to implement your recommendations?

Cheers,

Davo


Very interesting. Since Java 1.6 ships with CF8, I wonder if there are any compatibility issues with running 1.5?


My dev shop is planning how/when to upgrade to CF8, so thanks for the heads-up, Sean.

You mentioned that startup issues are more noticeable with certain frameworks. Is this happening when application-scoped CFCs are instantiated? Or is this more an issue with CFCs that dynamically load Java classes, such as Mark Mandel's JavaLoader?


@David Stamm, Mark Mandel's blog post - I'll repeat the link here - has deeper information about what exactly causes the problem:

http://www.compoundtheory.com/?action=displayPost&ID=270

@Terry Schmitt, CF8 on Mac uses the default Java installation which is Java 5 normally so, no, there be no compatibility issues (Pete Freitag's blog post notwithstanding).

@Davo, no, by default, Mac users who did not upgrade to Java 6 will not be affected and if they upgraded, they'll know how to downgrade. I don't use Windows so I can't give instructions for that. For Linux, you ought to know how to install JVMs/JDKs anyway so I'm not helping there either :)

@Bernie, yup, sounds like the right approach. For Java in general you can set the JAVA_HOME environment variable to point to Java 5 - exact details vary across operating systems.

@William, no. I don't use Windows.

@Marco, yes, CF8 lays down Java 6 on Windows and Linux (not on Mac).

@Marko, I was a bit surprised by Pete's post because I had only suggested moving CF8's tools.jar out of the way when he'd pinged me and I'd viewed the upgrade to Java 6 as a separate issue altogether. I think that just moving tools.jar should solve any compatibility issues you hit (because the tools.jar file that ships with CF8 probably assumes Java 6). Moving tools.jar out of the way causes CF to fall back to the installed Java compiler.


FWIW, I just tried the web service example code Pete posted on his blog and it works perfectly with CF8 on Java 5 *without* removing the tools.jar file. Not sure why Pete had a problem but it does not appear to be a Java 5 / Java 6 issue, at least for me.

@Marko, contact me privately to debug your web service problem if you want.


We are getting ready to upgrade at my office and we use Fusebox 5. I know we have a lot of .cfm files for each application with Fusebox, but does that consitute: "cause a large number of classes to be loaded at startup"? Each fuse file is compiled into a class, but is that what you mean?

Thanks a lot.


Sorry this is a bit off topic. Has anyone deployed CF8 on JBoss and then deployed their CF Application onto JBoss using an .EAR file? I can't seem to have CF8 and my Application in the server/default/deploy folder simultaneously? If I have both, then JBoss throws errors on start up. I've tried not including the CFAdmin when creating the jar, but there is sill a /CFIDE dir created and I think that's causing issues.

If you know of a resource that can help, I would appreciate it.


I might be bleeding ignorance here, but does this affect only server software? What about IDEs like Eclipse, eh?

DK


@Fred, unlikely. Fusebox by itself does not cause a large number of class files to be generated *at startup time*.

@Laurence, you're right, that's off-topic for this post. However, I will confirm you cannot have multiple EARs in the same server instance that contain ColdFusion. You either need a separate server instance or you need to use WARs. And that's not a JBoss thing really - I'm pretty sure you'll hit that on any J2EE server: it's just the way J2EE servers work.

@Douglas, you can configure each Java application to use a separate JVM / JDK if you want.


I'm just wondering if this issue still exists with the latest 1.6 Update 4?


@Dan, you could check which bugs they claim are fixed in the Java update - see the link to the Sun bugbase above for details. I know that the bug *has* been fixed at some point in the Java 6 stream and is not present in the Java 7 stream.


Has anyone been able to figure out what version of the JVM we would need to use to keep 1.6 while avoiding this bug? If it has been fixed I would like to keep 1.6.

Also... is there an updater planned to address this or are we responsible for finding this JVM on our own and pointing to it? I am assuming it is up to us since its a JVM issue but I thought I would ask...


@Drew, there is currently no supported version of Java 6 that fixes this bug, i.e., Adobe states which version of Java 6 they support for ColdFusion 8 but the bug is fixed in some later version of Java 6 (so they can't officially offer support for a version that wasn't available when they certified CF8).


Has anyone noticed performance improvement claimed by Adobe with CF8?

I tried CF 8 with both jre 5 and jre 6 and noticed no performance improvement at all in comparison with CF7. Or did anythings missing in my CF8 installation ....?


@Constantine, I've noticed huge performance boosts with CF8 and so has almost everyone I know - and Mike Brunt of Alagad has confirmed this with his benchmarking. Sounds like you have something unusual in your setup.


@Sean, what could be wrong in the my CF8 setup? does anyone know? I installed CF8 in a Window 2003 server, IIS 6, SQL server 2005, tried CF8 both with jre6 and jre5 and see no performance boosts....


@Constantine, without access to your code and your server, it's impossible to say.


We are running the same setup as Constantine (Window 2k3, IIS6, MSSQL 2k5 and 2k), and have also seen a marked slow-down side-by-side on CF8 when compared with a CF7 installation. We have down-graded the JRE which helped some, but it is still slower than on CF7. And, our application barely uses any components at all. It is very SQL heavy though - could this be a JDBC issue?


Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by