Humbly, I was wrong on the locks on application variables.. thats
information to file for later, thanks.
But I can't see how both CFIFs are necessary... The outer cfif will
likely never affect anything.
If two people hit the site, one request behind another, they'll both
fire all the way up to the cflock at the same speed, and as we all
know, that's where the magic comes in.. cflock single threads on the
init process and one is done before the other.. The outer cfif will
not catch anything that the inner cfif does not.
I do wonder if it might be smarter to set application.init to
SOMETHING before the init process inside the cflock... but I doubt
that would change anything either.
This is funny, we're arguing tiny fractions of time here..
On Fri, 31 Dec 2004 08:48:06 -0500, Jeffry Houser <[EMAIL PROTECTED]> wrote:
> I'm just gonna throw this out there. Would this be better?:
>
> <cflock name="InitApplication" timeout="30" throwontimeout="yes">
> <cfif NOT IsDefined("Application.Init")>
>
> ... long init process ...
>
> <cfset Application.Init = true />
>
> </cfif>
> </cflock>
>
>
> Person 1 comes in, Application.init is not defined, so they start initting
> the app.
> Person 2 comes in, and waits for the lock.
> Person 1 inits the app and releases the lock
> Person 2 gets the lock, sees it is already defined, and is all set
>
> I can understand why your "fix" worked, however I think the above code
> will accomplish the same thing.
> As someone else said, you'll grab the lock every time, but I believe that
> will be negligible in all cases except the one where the app is actually be
> initialized.
>
> At 04:01 AM 12/31/2004, you wrote:
>
> >Subject: Well - I feel like an idiot.
> >From: "Jim Davis" <[EMAIL PROTECTED]>
> >Date: Fri, 31 Dec 2004 00:00:41 -0500
> >Thread:
> >http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=37377&forumid=4#189043
> >
> >I've been having trouble with my application starting up under load.
> >Couldn't figure it out. Once it got going the application purred like a
> >contented cat, but the start up was another matter.
> >
> >Under even moderate load the app would kill JRun. Not good.
> >
> >Finally figured it - and I'm a dumb ass. I have code like this in the
> >system to handle start up tasks (which might take as long as 10 seconds to
> >complete):
> >
> ><cfif NOT IsDefined("Application.Init")>
> ><cflock name="InitApplication" timeout="30" throwontimeout="yes">
> >
> > ... long init process ...
> >
> > <cfset Application.Init = true />
> >
> ></cflock>
> ></cfif>
> >
> >See the problem? I didn't. Of course (like most things this works in
> >development fine - but under load the first thread will begin the process
> >and ALL the other active threads will queue up waiting to START IT AGAIN!
> >
> >Damn I'm dumb.
> >
> >The following code stops this from happening. Check the marker, then wait
> >for the lock - but then CHECK THE MARKER again to make sure you have to do
> >it!
> >
> ><cfif NOT IsDefined("Application.Init")>
> ><cflock name="InitApplication" timeout="30" throwontimeout="yes">
> ><cfif NOT IsDefined("Application.Init")>
> >
> > ... long init process ...
> >
> > <cfset Application.Init = true />
> >
> ></cfif>
> ></cflock>
> ></cfif>
> >
> >Completely eliminated all my start up issues.
> >
> >I suppose I could just get rid of the outer CFIF but then I'd be setting the
> >lock on every page - I've a gut feeling that's heavier than just doing the
> >CFIF.
> >
> >Jim Davis
>
>
> --
> Jeffry Houser, Web Developer, Writer, Songwriter, Recording Engineer
> AIM: Reboog711 | Phone: 1-203-379-0773
> --
> My Books: <http://www.instantcoldfusion.com>
> My Recording Studio: <http://www.fcfstudios.com>
> My Energetic Acoustic Rock Band: <http://www.farcryfly.com>
> --
> When did Reality Become TV
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189054
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54