Reputation: 73
I've inherited a CF application that currently runs on Fusebox 4.
I'm noticing quite a high number of application scope time-outs within the CF Administrator, and I'm not 100% about locking and where cflock should be used.
<cflock scope="application" type="exclusive" timeout="30">
<cfinclude template="fusebox4.runtime.cfmx.cfm">
</cflock>
Right now I can see a cflock around the main fusebox file. My instinct is telling me that this really isn't a sound practise. Can anyone advise if this is incorrect for a Fusebox application?
Upvotes: 1
Views: 219
Reputation: 7193
I'm not sure there is anything IN fusebox.runtime.cfmx.cfm that requires a full application lock. You should check. When you lock the whole "application scope" for each request you are affecting a sort of single-threading for that file. In other words 2 requests cannot run this file at the same time. Since it's a general file for the framework this greatly affects your scalability. As Germann has suggested an application be used judiciously - typically once for the life of the application.
Meanwhile the specific file in question (fusebox4.runtime.cfmx.cfm) has lots of things in that are not related to the application. You can't run the framework without it... I would removed this lock and examine fusebox4.runtime.cfmx.cfm to try and determine why someone felt it necessary to lock the file to begin with.
One more thing. There is a "MODE" setting somewhere in fusebox that can be set to DEV or "PROD" (my memory may be faulty). It could be that you are set to DEV - in which case lots of things are happening under the hood that you want to avoid - chiefly that each request is reassembling files in the "parsed" directory with each request. So check that one too.
Upvotes: 3
Reputation: 3353
Locks around big/long chunks of code IS a bad practice. In this case it should be really called only once at application start (if you use Application.cfc put it in OnApplicationStart() method, if you are still on Application.cfm then put it inside applicationStart/restart if block).
Upvotes: 1