[Looking for Charlie's main web site?]

Solving slow CF startup: my elaborating on an Adobe blog entry on a possible solution

Note: This blog post is from 2015. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
The fine folks at the Adobe CF blog posted a blog entry today, on "Sometimes ColdFusion services refuse to start normally post server restart" (by Rahul Upadhyay), which offers some helpful information on one possible solution to the stated problem of slow CF startup.

That said, there are some concerns I have, with respect to how I fear some may read and take action based on it (especially the notion of deleting the cfclasses files, as a possible solution to the problem).

I'm not contradicting Rahul here, just elaborating on some points, as someone who (like some on the CF team) helps people with CF server troubleshooting every day.

I started to write these thoughts as a comment there, and (as often happens) it grew long so I thought it better to be a blog entry rather than a long comment, and point people here. Once I did that I decided to go further still, hoping to really help those interested to consider the issue more carefully. (It also gives me a chance to highlight again the Adobe CF team blog, something I recommend EVERYONE reading this should follow!)

One quick point (and update) for the TL;DR cloud: My recommendation is that you move the cfclasses folder out of that location, as a temporary test, to see if it makes CF startup happen faster. If it does, I explain why and what the implications are in the choices of renaming, deleting, moving, or disabling the related "save class files" feature. Also, I add an update in E.1 below (since posting this) which you may really want to read: consider turning off your anti-virus software's real-time protection against the cfclasses folder to see if that alone helps with startup.

[....Continue Reading....]

Comments
Thanks for writing this in detail. This is very helpful for new CF admins who would want to know more about cfclasses.
# Posted By Rahul Upadhyay | 1/30/15 12:35 PM
@Rahul, thanks so much for the reply, and again for starting the conversation with your entry. :-)
# Posted By charlie arehart | 1/30/15 12:45 PM
TBH Charlie, a clear-out of the cfclasses occasionally is, I think, good advice.

It's also completely reversable... just run cfcompile over your app's directory and it'll recompile them all. With the added bonus of pointing out any files which have syntax errors in them, preventing compilation.

This has the benefit of only compiling the *current* files in the app. As CF never tidies-up after itself, it's difficult to tell what percentage of the files in that dir are a complete waste of space, and only serve to slow the system down (I think Windows struggles when there's more than 1000-odd files in a single directory)

Bottom line: I think Rahul's advice is perhaps incomplete, but it's still reasonable advice.

Cheers

--
Adam
# Posted By Adam Cameron | 1/30/15 1:43 PM
@Adam, yep, that's what I meant when I said:

"(Yes, there have been times over the years when some people have suggested deleting them to fix problems of updates not seeming to take, or some other problem. That's NOT the point Rahul is getting at.) "

Trust me, I am always keeping in mind ALL the readers of my blog when I wrote these blog entries, which is why they tend to get long. I'm trying to cover multiple bases, and address audiences of varying experience levels.

And that's why I added, "That's NOT the point Rahul is getting at." I do know there may be some who think even "do it regularly". Again, that's not the point of his blog entry. But if it's a side-benefit for those who would do it, fair enough. To that I stand by my later point, though, that "you MAY well notice some impact on request processing, once CF's up, as you/users process requests, and CF has to compile at least the first time each newly requested template. "

As I tried to convey throughout, there are a lot of moving parts to this, and different people know different things, and have vastly different environments, and pressures, and implications of choices.

What i do lament is any attempt to convey a suggestion that leaves the impression that "everyone should do x", if there are implications that are counter to that (but which may not be obvious).

As for whether the advice (from him or others) to clear out the entire CFClasses directory is "reasonable", well, I stand by my contention from the start: if you're doing this to see if it makes CF startup go faster, then don't delete the files. Rename the cfclasses and see if it starts up faster. If it does NOT, then this is NOT the solution to that problem.

But I hear you: there will be some side-benefit to clearing out the classes, to get rid of orphans. I mentioned that in passing.

And while I didn't mention how one can recompile templates, it was in fact discussed in the blog entry I pointed to from 2002, which opens, "In previous bog entries I've talked about compilation and precompilation of CFMX code into Java." I didn't bother to point out the links here, as again to me this was getting beyond the scope of this particular Adobe blog entry, and my reply.

But FWIW, I not only discussed the idea of precompiling templates early on, but I even offered an early form of a precompile.bat file, which presaged the cfcompile.bat which was ultimately included in CF starting CF7. For any interested, you can read here (http://cfmxplus.blog...) and the 2 articles I did on the topic in the CFDJ that year also, the second one at http://www.carehart.... (and linking to the first).

But I appreciate that you, too, Adam, were just trying to be more complete for people.

It's always a challenge for me to decide how much detail to get into. Part of me wants to be complete (for folks who will press if I do not), while part of me tries to be brief (for folks who will press if I do not). And you know that you're sometimes on either side of that fence yourself. :-)
# Posted By charlie arehart | 1/30/15 4:28 PM
Charlie,

I found this post today while having some startup issues on a multi-instance CF11 box. It turned out our issue had nothing to do with CF11.

Looking in the logs of each failed instance, I had a line like this:

"Error","localhost-startStop-1","07/09/15","06:01:59",,"Unable to initialise Monitoring service: coldfusion.server.ServiceException: Address already in use: bind"


When CF11 instances are created with monitoring enabled, it looks as if the jetty.xml file in each intance's /lib directory is configured to try to start the service on port 5050. I tweaked each to use an incrementally different port, rebooted the box, and all came back online happily.
# Posted By Joe Rinehart | 7/9/15 6:59 AM
Hi, Joe. Thanks so sharing that. Sure, it can happen (there are some other situations where ports can be mistakenly shared among instances of CF), and it's a good thing to remind people to consider.

I'm curious about your bringing that up here, though. Are you saying that in your case it led CF to take a long time to start, and since this entry is about Adobe's blog entry that proposed one solution to CF being slow to start?

It's that I'd think that a port conflict would keep CF from starting at all. Is that what happened? If so, sure, again it's good to let people know of how that might be solved. But if it did cause CF to be "slow to start", I would be curious to hear that.

(To any readers who may say that they've experienced things being "slow" when there are port problems, that's indeed so when something as a client is calling something as a server, and that port is blocked. The client will hang quite a while. But Joe's talking here about CF as a server trying to set a port it should listen on. In most cases, when CF tries to listen on a port that is already taken, then CF will generally not start at all.)

Just saying that CF not starting at all is a different problem from the focus of the Adobe blog post I was responding to here. :-) Again, though, Joe, if it may help some reader, thanks for sharing it.
# Posted By charlie arehart | 7/9/15 12:36 PM
Copyright ©2020 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting