Viewing By Entry / Main
January 14, 2009
Update: The Java 6 class loader bug mentioned in this post was fixed in Update 10. I just upgraded a 64-bit Red Hat Linux server to Java 6 Update 11 and changed the jvm.config file to specify the new JDK's jre directory for java.home. After restarting the server, it was able to serve up the first page of a complex Model-Glue / ColdSpring / Transfer application in just a few seconds. With the default JDK installed by ColdFusion 8 (1.6.0_04), it took between 30 and 60 seconds to serve that first page. I have updated this blog post accordingly. Thanx to Charlie Arehart for prodding me earlier today on this issue.
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 is to upgrade your Windows or *nix JDK to Java 6 Update 11 and use that to power ColdFusion 8. On Windows and Linux, you'll need to download and install the Java 6 Update 11 JDK from http://java.sun.com 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). Changing java.home in jvm.config is probably the easiest way to tell CF8 to use the new JDK - it needs to point to the jre directory inside the JDK install. On a Mac it's easier to revert to Java 5 which is the default JDK and CF8 automatically uses it.

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?


Sean,

There are a number of Bugs in 1.6 that I have run into that seemed to be resolved in 1.6.0_06. I wonder if you could confirm that it resolves this issue for me since it seems to have for me but I dont have time to test on multiple machines and multiple architectures (I am using 64 bit on VISTA).

Thanks,

R


@Robi, CF8.0.1 ships with 1.6.0_04 and that's what I'm using on some servers - and 1.5.x on others. I don't have a later version of 1.6.x to test on at the moment.


Hi Sean,

Im new to FB5, im also getting endless compile, ive spent a few days trying to find where im going wrong but ive had no joy. Im not sure if im doing something wrong or its the jre (1.6.0_06) that im using on CF8 (win platform).

Do you know if bug has been fixed in version 1.6.0_06 or do i need to install 1.5?

Thanks Dl.


@DaveL, Sun has not yet fixed the bug (it is scheduled to be fix in the 0_10 revision of Java 1.6). You might find your problem goes away if you install Java 1.5 and make ColdFusion use that.


A fix appears to be out now. JDK 6 update 10.

http://java.sun.com/javase/downloads/?intcmp=1281

I am quite eager to know what others are experiencing with this recent release from sun, in a production environment.


@all, I have updated this blog post to reflect the availability of Java 6 Update 11 which I have tested with CF8 (even tho' it is not officially supported by Adobe).


My guess is that the SSL problem with the JRun Webserver is still present in Java 6 Update 11 - this is a deal breaker for us and it's keeping us on Java 1.5


@James, could you elaborate? I have not heard of that sort of problem...


How timely to my own development adventures; as I just updated because of the slow load times of Model Glue. This was my exact error:

http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54742

Even after the update to Java 6 Updater 11; I'm still having insanely slow times on the first load of a Model Glue app. I set the timeout w/ a cfsetting tag to four minutes and it appears to have addressed the issue.

After the first load things appear to run quite smoothly.

This update does change the HTML generated from the cfmenu tag; however I suspect that will only affect people if they are using cfmenu with a lot of custom styling (I was).


@Jeffry, have you made sure to turn OFF Report Execution Times in the CF Admin and also looked at the Server Monitor to ensure you don't have any of the monitoring / profiling enabled?


Hi Sean,

I'm wondering if this JVM issue is affecting me. I'm running OS X 10.5.6, with CF8 with JRun as my development system, and am running fusebox 5.5. I have a fusebox app that times out in the fuseboxAction.cfc. The error specifically is a timeout on CFLOOP.

It looks like I'm still running 1.5.0_16-133 of JVM. Am I barking up the wrong tree here?

Thanks putting your mind to this! JP


@JP, make sure Report Execution Times is OFF in the CF Admin and that Memory Tracking is OFF in the Server Monitor (and Profiling is OFF as well, although the overhead from that is not so great).

Also in Terminal, run java -version to confirm the default JVM in use and look in the CF Admin under Server Settings > Settings Summary to confirm CF8 is using the right JVM.

If all of those look good, I'd ask: how many circuits / fuseactions are there in your app and are you using XML (which loads all the circuits at startup)?


I tried updating CF Administrator (Developer) as described above and the jvm.config file was successfully updated to the java 1.6._11 directory. However.... the Windows Service for Coldfusion Application is still pointing to the old java directory. Result = Coldfusion is unable to start. Am I missing something here?

I have tried rebooting... no difference. If i restore the jvm.confik.bak file, I have Coldfusion but with the original java settings.

Any ideas? Thanks.


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