> As I understand it, CFLOCKing reads and writes to the shared
> variable scopes (session, application, server) prevents
> possible data corruption caused by simultaneous reads and writes.
>
> My question is: if the data in the shared scopes is written very
> infrequently but read often, couldn't I just lock the writes
> and thereby still avoid the possible corruption?
>
> Here's the scenario: I keep structures and/or queries of often used
> information in application scoped variables to avoid repetitive
> database queries.  This data rarely changes, so I'm wondering if
> I could bypass the performance hit of CFLOCKING access to this data.
> As long as I lock any updates to this data then there won't be any
> danger of corruption, correct? Or am I way off base here?

I don't claim to know all about how the CF server functions internally; how
it manages memory and handles concurrent threads/requests that touch the
same parts of memory. That's what I'd really have to know to answer this
question with certainty. In the absence of that knowledge, I'll go by the
information that I've read and observed about locking memory variables.

It's possible that concurrent reads might cause memory corruption issues
under high load. CFLOCK may prevent this - it seems to have minimized memory
corruption issues in my experience. If this is the case, then you would want
to lock all reads, in addition to locking writes. Also, I haven't noticed
any performance degradation using CFLOCK. I haven't done any strenuous
testing of this, so there may well be some performance hit.

I would recommend, pending any further information from Allaire, that you
lock all access to memory variables, period. This way, your applications
will be safer, even though you may sacrifice a bit of performance and a
little extra coding time.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to