That's the downside! Also, they are unique to each request, so memory &
processor usage will increase by a set amount for each page request.

e.g.

APPLICATION scope
--------------------

<cflock scope="APPLICATION" .....>
        <cfif NOT IsDefined( "APPLICATION.TestVar" )>
                <!--- Set up (say) 2KB of application variables --->
        </cfif>
</cflock>

- First request, you get a CPU performance hit while you set up the app.
variables, and 2KB of memory is taken up by the variables.
- Subsequent requests will detect the existence of APPLICATION.TestVar, and
not bother setting the variables up again.
- Total memory usage - 2KB for the application variables, however many page
requests are made.


REQUEST scope
-------------

<cfset REQUEST.(whatever) = (whatever)>
....
....
....
<!--- set up the same 2KB of variables in the request scope --->

- Every single request will use the CPU while setting up the variables, and
need the 2KB of memory for itself. 
- If you're in a frameset, that's (say) 3 times the CPU usage and an extra
4KB of memory per client, per hit.
- Total memory usage - 2KB * number of frames * number of simultaneous
users.

If you're using the scope to store queries or other complex objects, or even
long strings, you're going to end up with a fairly hefty performance hit.


Alistair Davidson
Senior Developer
Rocom New Media
www.rocomx.net



-----Original Message-----
From: Steve Vosloo [mailto:[EMAIL PROTECTED]]
Sent: 29 May 2001 14:43
To: CF-Talk
Subject: RE: Request vs application scope


Brilliant! So what's the downside? The variables are not persistent across
pages are they?



> -----Original Message-----
> From: Daniel Lancelot [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 29, 2001 2:56 PM
> To: CF-Talk
> Subject: RE: Request vs application scope
>
>
> Yes thats right.
>
> -----Original Message-----
> From: Steve Vosloo [mailto:[EMAIL PROTECTED]]
> Sent: 29 May 2001 13:51
> To: CF-Talk
> Subject: RE: Request vs application scope
>
>
> Thanks.
>
> Can I put any data in there that I want to use across the site?
> And I don't
> have to apply CFLOCKs do I?
>
>
>
> > -----Original Message-----
> > From: Daniel Lancelot [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 29, 2001 2:32 PM
> > To: CF-Talk
> > Subject: RE: Request vs application scope
> >
> >
> > Absolutely no problem... I do it regularly...
> >
> > -----Original Message-----
> > From: Steve Vosloo [mailto:[EMAIL PROTECTED]]
> > Sent: 29 May 2001 08:34
> > To: CF-Talk
> > Subject: Request vs application scope
> >
> >
> > I am using the following line of code in my application.cfm
> >
> > <cfset request.HomeDir = "http://127.0.0.1/work/ACME/may2001/website";>
> >
> > Then elsewhere in the site I refer all links and images to:
> >
> > <cfoutput>#request.HomeDir#</cfoutput>
> >
> > Is this OK to do? I'm trying to avoid using the application
> > scope. Are there
> > any known of issues with this method?
> >
> > Thanks.
> > Steve
> >
> >
> >
> >
> >
> > Development Manager
> > Vardus Internet Solutions (SA)
> >
> > Tel: (+27) 21 670 9880
> > Fax: (+27) 21 674 4549
> >
> > Email: [EMAIL PROTECTED]
> > Website: www.vardus.com
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to