>
> I'm confused about the locks then. I thought locks would decrease
> performance as well. If have to put blocks around all the blocks of code,
> is there a performance hit that conceivably outweighs the gains of only
> setting the variable once?
>
> For instance, if the DSN is stored as an application variable (which makes
> sense... at least it meets the criterion I'm seeing mentioned) then I have
> to put locks around all the queries. Is that efficient?
>
No that's not efficient.
>From Allaire's ColdFusion Locking Best Practices document (17318), which
Neil was/had read, you are supposed to do this......
<Cflock scope="application" type="readonly" timeout="2">
<Cfset request.dsn = application.dsn>
</cflock>
<Cfquery datasource="#request.dsn#" ..........
as opposed to what you're suggesting which is.....
<cflock scope="application" type="readonly" timeout="2">
<Cfquery datasource="#application.dsn#" .....>
.
.
</cflock>
I have to say, that I understand the reasons for using application variables
and I know the best practices, but I'm having problems resolving the
efficiency of either using just request scope or using application
variables................
OK here we go.....
Request Scope variables.
Pros
-----
1) No Locking
Cons
-----
1) Must be reset every time a user hits the app_globals/application.cfm
2) Each User session must hold a copy of the variables in memory on the
server for the duration of processing the page.
Application variables
Pros
-----
1) Only one copy of the variables held on the server, therefore increasing
efficiency server memory usage.
2) If coded well, they need only be set every once in a while.
Cons
-----
1) Must be locked for read and write actions
2) Best practices require that you write the application variable you wish
to use to a standard memory variable (Scope : variables, attributes,
request) thus negating the memory and processor saving in 1 and 2.
So what the hell are you supposed to do??? Both ways are bad!!!!!
I suppose using application variables, using short timeouts on the locks and
only setting the variables that you actually need when you need them, would
possibly better, because using much smaller amounts of memory and less
setting of standard variables than
Anyone want to add to this??
Douglas, with client variables if your client has cookies switched off then
your site will stop working... Take care......
James, Just so you know, when you use the setting in CF admin for read
locking, cf server will actually insert the locking code when its
pre-compiled, so there is a larger performance degradation than if you
actually put the locks in yourself, because it has to also find where it
needs to put the locks..... Otherwise despite EST, you made sense... ;o>
Regards
Stephen
------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.