Hello folks,

I've been using application variables to hold highly structured data and
have decided that I should probably put CFLOCKs around access to them. I
have two questions:

1) In preliminary testing I've found that there is a HUGE speed increase
when you use named locks rather than scoping a lock to session, application
etc. When using named locks a given template has an executions time of 1000
ms. When I change all the locks to become application scoped instead the
page execution times jump to about 4000 ms. How does Cold fusion internally
process a tag like <CFLOCK name="updateUserInfo" timeout="3"
type="READONLY"> vs
<CFLOCK scope="application" timeout="3" type="READONLY"> What would account
for this speed increase?

2) The documentation says that you should puts locks around any code that
reads or writes to a shared memory resident variable. For function calls
like StructCopy, StructUpdate, StructInsert this makes sense. But what about
StructFind, StructKeyExists and IsStruct? Are those function calls actually
reading from my application variable and thus need to have locks placed
around them? I don't want to globally lock things from the CF Administrator
because I think that's a pretty big performance liability. Also if an
IsStruct function is a read then where would you put the beginning and
ending CFLOCK tags in the following scenario

<CFIF IsStruct(application.userInfo)>
about 50 to 60 lines of code
</CFIF>

Would it be like this:
 1)
<CFLOCK name="readUserInfo" type="READONLY">
<CFIF IsStruct(application.userInfo)>
about 50 to 60 lines of code
</CFIF>
</CFLOCK>

or like this:
2)
 <CFLOCK name="readUserInfo" type="READONLY">
<CFIF IsStruct(application.userInfo)>
</CFLOCK>
about 50 to 60 lines of code
</CFIF>

Scenario 2 would be preferable because I'm only locking the call that
actually tests for the existence of the variables rather than locking a
whole bunch of unrelated code, but the nesting looks like it really
shouldn't work.

Any information would be appreciated.

Edward Chowdhury


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to