3

We have two Coldfusion servers that have a huge performance difference running the exact same code on the exact same input data. The code in questions instantiates a large amount of CFCs (Coldfusion Components, which are similar to objects in OOP languages).

I compared the two servers by running Process Monitor and then calling the problematic code on both machines. I learned two things. First, Coldfusion opens CFC files every time it instantiates an object. Both servers do this, so it cannot be the cause of the performance difference. Second, the fast server opens the CFC files directly while the server with the performance problem seems to navigate its way through the path until it reaches the desired CFC file. It does this for every file, even the ones it has previously loaded, and because the code instantiates so many CFCs it becomes very slow. See below the partial Promon traces that show this behavior. It can take over 60 seconds for the slow server to do what the fast one does in 2 seconds.

Can anyone tell me what causes this behavior? Is it a Coldfusion setting? Since Coldfusion runs on top of Java, is it a Java setting? Is it an OS option? The fast server is running Windows XP and I think the slow server is a Windows Server 2003.

Bonus question: Coldfusion doesn't seem to perform any READ FILE operations on any of the CFC or CFM files. How can this be?

Sample of the fast server opening CFC files:

11:25:14.5588975    jrun.exe    QueryOpen                   C:\CF\wwwroot\APP\com\HtmlUtils.cfc
11:25:14.5592758    jrun.exe    CreateFile                  C:\CF\wwwroot\APP\com\HtmlUtils.cfc
11:25:14.5595024    jrun.exe    QueryBasicInformationFile   C:\CF\wwwroot\APP\com\HtmlUtils.cfc
11:25:14.5595940    jrun.exe    CloseFile                   C:\CF\wwwroot\APP\com\HtmlUtils.cfc
11:25:14.5599628    jrun.exe    CreateFile                  C:\CF\wwwroot\APP\com\HtmlUtils.cfc
11:25:14.5601600    jrun.exe    QueryBasicInformationFile   C:\CF\wwwroot\APP\com\HtmlUtils.cfc
11:25:14.5602463    jrun.exe    CloseFile                   C:\CF\wwwroot\APP\com\HtmlUtils.cfc

Equivalent sample of the slow server opening CFC files:

11:15:08.1249230    jrun.exe    CreateFile                  D:\
11:15:08.1250100    jrun.exe    QueryDirectory              D:\org
11:15:08.1252852    jrun.exe    CloseFile                   D:\
11:15:08.1259670    jrun.exe    CreateFile                  D:\org
11:15:08.1260319    jrun.exe    QueryDirectory              D:\org\cli
11:15:08.1260769    jrun.exe    CloseFile                   D:\org
11:15:08.1269451    jrun.exe    CreateFile                  D:\org\cli
11:15:08.1270613    jrun.exe    QueryDirectory              D:\org\cli\cpn
11:15:08.1271140    jrun.exe    CloseFile                   D:\org\cli
11:15:08.1279312    jrun.exe    CreateFile                  D:\org\cli\cpn
11:15:08.1280086    jrun.exe    QueryDirectory              D:\org\cli\cpn\APP
11:15:08.1280789    jrun.exe    CloseFile                   D:\org\cli\cpn
11:15:08.1291034    jrun.exe    CreateFile                  D:\org\cli\cpn\APP
11:15:08.1291709    jrun.exe    QueryDirectory              D:\org\cli\cpn\APP\com
11:15:08.1292224    jrun.exe    CloseFile                   D:\org\cli\cpn\APP
11:15:08.1300568    jrun.exe    CreateFile                  D:\org\cli\cpn\APP\com
11:15:08.1301321    jrun.exe    QueryDirectory              D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1301843    jrun.exe    CloseFile                   D:\org\cli\cpn\APP\com
11:15:08.1312049    jrun.exe    CreateFile                  D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1314409    jrun.exe    QueryBasicInformationFile   D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1314633    jrun.exe    CloseFile                   D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1315881    jrun.exe    CreateFile                  D:\
11:15:08.1316379    jrun.exe    QueryDirectory              D:\org
11:15:08.1316926    jrun.exe    CloseFile                   D:\
11:15:08.1330951    jrun.exe    CreateFile                  D:\org
11:15:08.1338656    jrun.exe    QueryDirectory              D:\org\cli
11:15:08.1339118    jrun.exe    CloseFile                   D:\org
11:15:08.1526468    jrun.exe    CreateFile                  D:\org\cli
11:15:08.1527295    jrun.exe    QueryDirectory              D:\org\cli\cpn
11:15:08.1527989    jrun.exe    CloseFile                   D:\org\cli
11:15:08.1531977    jrun.exe    CreateFile                  D:\org\cli\cpn
11:15:08.1532589    jrun.exe    QueryDirectory              D:\org\cli\cpn\APP
11:15:08.1533575    jrun.exe    CloseFile                   D:\org\cli\cpn
11:15:08.1538457    jrun.exe    CreateFile                  D:\org\cli\cpn\APP
11:15:08.1539083    jrun.exe    QueryDirectory              D:\org\cli\cpn\APP\com
11:15:08.1539553    jrun.exe    CloseFile                   D:\org\cli\cpn\APP
11:15:08.1544126    jrun.exe    CreateFile                  D:\org\cli\cpn\APP\com
11:15:08.1544980    jrun.exe    QueryDirectory              D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1545482    jrun.exe    CloseFile                   D:\org\cli\cpn\APP\com
11:15:08.1551034    jrun.exe    CreateFile                  D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1552878    jrun.exe    QueryBasicInformationFile   D:\org\cli\cpn\APP\com\HtmlUtils.cfc
11:15:08.1553044    jrun.exe    CloseFile                   D:\org\cli\cpn\APP\com\HtmlUtils.cfc

Thanks

  • 1
    Who the hell is voting to close this? It's a very good question! What is wrong with you people? – Adam Cameron Nov 23 '12 at 15:10
  • 1
    I guess perhaps the question might better be asked on serverfault, but the problem is the attention ColdFusion questions get over there is a bit rubbish. It's better off being left here, and people to get over themselves. – Adam Cameron Nov 23 '12 at 15:14
  • @AdamCameron - the down votes might be coming from people reading the java, webserver, or procmon pages. –  Nov 23 '12 at 16:22
  • There are no down votes, there are only close/migrate votes - perfectly valid votes. If CF doesn't get attention on [SF] then _fix that problem_, instead of complaining about people that probably wont even see the complaints. – Peter Boughton Nov 23 '12 at 16:43
  • 1
    They're not perfectly valid, Peter, because they haven't taken the time to attempt to help correct the problem. It's just typical S/O power-trip nazism. The object of the exercise here is not to slavishly follow rules and anonymously bully newbies, it's to HELP PEOPLE. – Adam Cameron Nov 23 '12 at 16:50
  • 2
    I'd agree this question is better suited for Server Fault: it's a system administration issue, not a code issue. – Billy Cravens Nov 23 '12 at 17:22
  • 1
    Adam, have _you_ taken the time to attempt to help correct the problem? It seems you're just complaining where it almost certainly _wont be seen_ by anyone relevant. If you want to have a chance of making a difference, complain on [meta](http://meta.stackoverflow.com/). – Peter Boughton Nov 23 '12 at 17:24
  • This instance isn't mindless closing as "not a question" - the migrate votes are by people taking the time (even if only four clicks of time) to direct the asker to the area dedicated for experts in that subject, where they are more likely (in general) to get accurate/helpful advice. It's not bullying, and it's certainly not comparable to mass genocide! – Peter Boughton Nov 23 '12 at 17:25
  • And, again, if the problem is [SF] not getting enough attention, then you are well suited to encourage more attention. – Peter Boughton Nov 23 '12 at 17:25
  • @Billy, sure: according to *The Rules*, it's more suited to here, fine. According to the intent of this whole enterprise - helping people with problems - it would be far more sensible to leave it where it was, where CF folk actually pay attention. And where it was doing no harm. This is what I mean by slavishly following rules (sometimes simply for the sake of being bossy, I think). It's daft. Peter, I cannot make a web site popular with the CF community, sorry. Especially one that increasingly leaves a foul taste in my mouth due to... this sort of practice. – Adam Cameron Nov 23 '12 at 20:14
  • 1
    "*Bonus question: Coldfusion doesn't seem to perform any READ FILE operations on any of the CFC or CFM files. How can this be?*" Once it reads the basic information, it knows that the files haven't been modified. This is a cache validity check. – David Schwartz Nov 23 '12 at 21:32
  • @DavidSchwartz - That makes a whole lot of sense. Thanks. – Francis Gagnon Nov 23 '12 at 22:10

3 Answers3

7

It sounds to me like you don't have "Component cache" checked in CFAdmin (Server Settings > Caching) on the slow server.

Another possibility is that you've got different CF mappings (Server Settings > Mappings) and/or custom tag paths (Extensions > Custom Tag Paths) set between the two servers.

It's most likely to be the former though.

You could also set "Cache Template In Request" (Server Settings > Caching) to prevent the file look-up for the same CFC after the first one for a given request, and if it's a production server, check "Trusted cache" (Server Settings > Caching) too, which will prevent any file system look-ups if the file has already been loaded once.

ColdFusion will also only maintain a specific number of compiled files in memory at a time, set by "Maximum number of cached templates" (Server Settings > Caching), and you should try to set this to encompass the total number of CFML files (and CFC methods, each of which compile down to a class of their own) in your app. Obviously this is predicated on having enough RAM available to the JVM to handle this. It can be a bit of a balancing act.

Adam Cameron
  • 252
  • 4
  • 14
  • Hi Adam, I should have mentioned that I am running Coldfusion8 Developer edition on the fast server and the full regular version of Coldfusion8 on the slow one. I don't seem to have all the caching options you are talking about. I'll speak with the server folks to see if their version has them. –  Nov 23 '12 at 14:59
  • Ah, OK. The CF version (ie: full or dev) should not matter as far as I know. I don't have CF8 here to check on, but when I get home from work (+3h from now), I'll have a look for the CF8 equivs of those settings. – Adam Cameron Nov 23 '12 at 15:11
  • OK, there's no similar setting in CF8. Damn. Did you check the mappings & custom tag paths? Plus the other advice stands, although it is not part of the solution to this problem. Hopefully someone else will see this and give you some other suggestions. – Adam Cameron Nov 23 '12 at 20:22
  • Thanks Adam. I'll speak with the server admin to discuss these points with him, but it looks like the person I will be speaking with is not in today. I'll have to see about this early next week. – Francis Gagnon Nov 23 '12 at 20:37
5

Try checking:

  1. JVM Settings especially memory settings
  2. Make sure debug mode is off
  3. Virus scan settings. See if one has Java files skipped
  4. Check where cfdump is being used.
James A Mohler
  • 243
  • 4
  • 19
3

Along the lines of Adam Cameron's answer, I'd suggest comparing C:\ColdFusion8\lib\neo*.xml on both machines and working through the differences, particularly neo-runtime.xml and neo-debug.xml - these are where the config for ColdFusion are stored. Post any interesting differences here.

If you don't have a diff tool, use the trial version of BeyondCompare as it'll do whole directories and supports XML well.

barnyr
  • 236
  • 1
  • 2
  • 5
  • I purchased Beyond Compare a while ago and use it more frequently than I ever anticipated. – Francis Gagnon Nov 27 '12 at 14:45
  • After more investigation and trying things out, I eventually found that the option "Security > Sandbox Security > Enable ColdFusion Security" is what causes the different behavior shown in the Process Monitor traces shown in my question. The page execution has slowed down on the fast server but is still faster than the slow server. Further comparison of the Procmon traces show that while the two servers now perform very similar operations, the slow server is still taking more time to do them. I have new questions, but at least I have my answer for this one. Thanks to everyone. – Francis Gagnon Nov 27 '12 at 14:53
  • 1
    Very glad you got to the bottom of it! Regarding BC, I really can't imagine how I got things done without it. – barnyr Nov 27 '12 at 20:51