Re: Another Locking Question

2003-01-14 Thread Sean A Corfield
On Monday, Jan 13, 2003, at 22:27 US/Pacific, Matt Robertson wrote:
> Client vars are, for my money, the Holy Grail with respect to 
> completely
> replacing session vars.  Scaleable to clusters, zero locking issues,
> maintain state, and expiration can be controlled precisely like session
> vars with about 2 lines of code in application.cfm.  Store 'em in a db,
> tho'.  Leave the Registry alone at all costs.

Note that with CFMX for J2EE you can use J2EE session variables and 
take advantage of clustering, session fail over etc without the 
overhead of hitting the database and without the limits of cookies (to 
say nothing of the problems of trying to use the registry).

Sean A Corfield -- Director, Architecture
Web Technology Group -- Macromedia, Inc.
tel: (415) 252-2287 -- cell: (415) 717-8473
aim/iChat: seancorfield -- http://www.macromedia.com
An Architect's View -- http://www.macromedia.com/go/arch_blog

ColdFusion MX and JRun 4 now available for Mac OS X!
http://www.macromedia.com/go/cfmxosx

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: Another Locking Question

2003-01-13 Thread Matt Robertson
Dave Watts wrote
>In general, I'm not a big fan of this approach,

Me neither, especially since not locking the session var in the
isdefined() as was shown in the original post is improper.  You would
have to lock the whole thing, cfif isdefined and all.

Client vars are, for my money, the Holy Grail with respect to completely
replacing session vars.  Scaleable to clusters, zero locking issues,
maintain state, and expiration can be controlled precisely like session
vars with about 2 lines of code in application.cfm.  Store 'em in a db,
tho'.  Leave the Registry alone at all costs.

My .02,


 Matt Robertson   [EMAIL PROTECTED] 
 MSB Designs, Inc.  http://mysecretbase.com


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: Another Locking Question

2003-01-13 Thread Dave Watts
> I got a tip previously on cf-talk that advised me to do 
> this in my application.cfm:
> 
> 
> 
>   
>   
>   
> 
> 
> 
> 
>   
> 
> 
> Is this good or bad? (My sites typically have between 10 
> and 200 connections.)

In general, I'm not a big fan of this approach, which is basically intended
to keep you from having to do the actual work of using CFLOCK tags within
your code. In my experience, this causes significant overhead within the
application.

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

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-13 Thread Christian Cantrell
If you are going to put initialization code like this in your  
Application.cfm file, just be sure that you do not use any code that  
can generate another HTTP request for another CFM file (such as a  
cfhttp tag) as you may either create an infinite loop (with a readonly  
lock) or a deadlock (with an exclusive lock) because your  
Application.cfm file will keep getting invoked.

Christian

On Monday, January 13, 2003, at 02:01 PM, Mike Alberts wrote:

> Ok, I thought I had the locking thing squared away, but after reading  
> this thread, I realize that I do not. I was not aware of the potential  
> problems of using an exclusive lock in the Application.cfm file.
>
> So ... is this (psuedo) code a reasonable solution?
>
> Open readonly lock
>
>  If NOT IsDefined(SomeApplicationVariable)
>
>   cfinclude template = "file to initialize app variables"
>
>  close cfif
>
> close readonly lock
>
> Mike
> 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: Another Locking Question

2003-01-13 Thread Everett, Al
No, it isn't, because I presume you'll have an EXCLUSIVE lock in the include
file, putting an EXCLUSIVE lock inside a READONLY lock. Bad, bad, bad.

We've found using Application variables generally isn't necessary. We
include a file in Application.cfm that sets all the global variables we need
in the Request scope.

> -Original Message-
> From: Mike Alberts [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 13, 2003 2:02 PM
> To: CF-Talk
> Subject: Another Locking Question
> 
> 
> Ok, I thought I had the locking thing squared away, but after 
> reading this thread, I realize that I do not. I was not aware 
> of the potential problems of using an exclusive lock in the 
> Application.cfm file.
> 
> So ... is this (psuedo) code a reasonable solution?
> 
> Open readonly lock
> 
>  If NOT IsDefined(SomeApplicationVariable)
> 
>   cfinclude template = "file to initialize app variables"
> 
>  close cfif
> 
> close readonly lock
> 
> Mike
> 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-13 Thread Chris Norloff
Yes. Yes.

-- Original Message --
From: "Webmaster" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
date: Sun, 12 Jan 2003 15:23:55 -0500

>Hi,
>  If I reference an APPLICATION var using isDefined, do I have to read lock
>it.  Is the var really being read?
>
>
>
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: Another Locking Question

2003-01-12 Thread Matt Robertson
I didn't mean to imply that there wasn't a dumb way to use cflock :D,
just that its *proper* use is going to give good results and the reverse
can *generally* be counted on to do the opposite.  My point was that if
you are going to use shared scope vars, lock 'em always.


 Matt Robertson   [EMAIL PROTECTED] 
 MSB Designs, Inc.  http://mysecretbase.com


-Original Message-
From: Sean A Corfield [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, January 12, 2003 2:00 PM
To: CF-Talk
Subject: Re: Another Locking Question


On Sunday, Jan 12, 2003, at 13:23 US/Pacific, Matt Robertson wrote:
> I have yet
> to see any instance where locking instituted any noticeable
performance
> penalty at any level.

If you lock within Application.cfm, you will single-thread your 
application and it will not scale. For low-traffic applications, that 
may be fine.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-12 Thread Sean A Corfield
On Sunday, Jan 12, 2003, at 14:20 US/Pacific, Jochem van Dieten wrote:
> Sean A Corfield wrote:
>> If you lock within Application.cfm, you will single-thread your
>> application and it will not scale. For low-traffic applications, that
>> may be fine.
> I think that is a bit of an oversimplification. Maybe it is a good idea
> to distinguish between readonly and exclusive locks and between
> different scopes.

True. My bad. I was in a hurry. cflock type="exclusive" on every 
request will single-thread your application. cflock type="readonly" 
will not. However, to avoid race conditions, you may still need to use 
exclusive locks - you just have to be careful about it (Marcello's 
great tip on this is in my blog entry).

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-12 Thread Antony Sideropoulos
I got a tip previously on cf-talk that advised me to do this in my 
application.cfm:














Is this good or bad?  (My sites typically have between 10 and 200 
connections.)

>
>Sean A Corfield wrote:
> > On Sunday, Jan 12, 2003, at 13:23 US/Pacific, Matt Robertson wrote:
> >
> >>I have yet
> >>to see any instance where locking instituted any noticeable performance
> >>penalty at any level.
> >
> >
> > If you lock within Application.cfm, you will single-thread your
> > application and it will not scale. For low-traffic applications, that
> > may be fine.
>
>I think that is a bit of an oversimplification. Maybe it is a good idea
>to distinguish between readonly and exclusive locks and between
>different scopes.
>But if we are talking performance penalties, single-threaded sessions
>are evil.
>
>Jochem
>



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-12 Thread Jochem van Dieten
Sean A Corfield wrote:
> On Sunday, Jan 12, 2003, at 13:23 US/Pacific, Matt Robertson wrote:
> 
>>I have yet
>>to see any instance where locking instituted any noticeable performance
>>penalty at any level.
> 
> 
> If you lock within Application.cfm, you will single-thread your 
> application and it will not scale. For low-traffic applications, that 
> may be fine.

I think that is a bit of an oversimplification. Maybe it is a good idea 
to distinguish between readonly and exclusive locks and between 
different scopes.
But if we are talking performance penalties, single-threaded sessions 
are evil.

Jochem

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-12 Thread Sean A Corfield
On Sunday, Jan 12, 2003, at 13:23 US/Pacific, Matt Robertson wrote:
> I have yet
> to see any instance where locking instituted any noticeable performance
> penalty at any level.

If you lock within Application.cfm, you will single-thread your 
application and it will not scale. For low-traffic applications, that 
may be fine.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: Another Locking Question

2003-01-12 Thread Matt Robertson
While there arguably are circumstances where you don't need to lock, if
you just do it always, everywhere (subject to the smart use of temp vars
as was pointed out already), your code will work properly.  I have yet
to see any instance where locking instituted any noticeable performance
penalty at any level.  

Just Say Yes to CFLock... Always and Forevermore.

:-)


 Matt Robertson   [EMAIL PROTECTED] 
 MSB Designs, Inc.  http://mysecretbase.com


-Original Message-
From: Webmaster [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, January 12, 2003 12:24 PM
To: CF-Talk
Subject: Another Locking Question


Hi,
  If I reference an APPLICATION var using isDefined, do I have to read
lock
it.  Is the var really being read?



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-12 Thread Gyrus
- Original Message -
From: "Webmaster" <[EMAIL PROTECTED]>
>   If I reference an APPLICATION var using isDefined, do I have to read
lock
> it.  Is the var really being read?
---

Yep - if you're not on CFMX, even IsDefined("sharedScope.varName") needs a
lock around it. If you need to reference this more than once in a template,
of course, set a temp variable:





Gyrus
[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://norlonto.net
PGP key available

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: Another Locking Question

2003-01-12 Thread Sean A Corfield
On Sunday, Jan 12, 2003, at 12:23 US/Pacific, Webmaster wrote:
>   If I reference an APPLICATION var using isDefined, do I have to read 
> lock
> it.  Is the var really being read?

No, but...

If you are trying to avoid a race condition, you may need to lock. See 
my blog entry:

http://www.corfield.org/blog/2003_01_01_archive.html#87048759

Sean A Corfield -- Director, Architecture
Web Technology Group -- Macromedia, Inc.
tel: (415) 252-2287 -- cell: (415) 717-8473
aim/iChat: seancorfield -- http://www.macromedia.com
An Architect's View -- http://www.macromedia.com/go/arch_blog

ColdFusion MX and JRun 4 now available for Mac OS X!
http://www.macromedia.com/go/cfmxosx

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4