Ok, client vs. session variables 101.

Session variables are stored in RAM on the CF server which is all fine and
dandy until you create a load-balanced cluster.  In a cluster the
load-balancing equipment can switch a session to a less busy server at any
time - thereby losing a clients session variables (not good).  
Client variables, however, can be stored in the database (or registry or
cookies) and therefore are not server dependant (well, the registry is
server dependant).  Here's a few points to remember that tripped me up when
I first started using them:

1. When declaring CFAPPLICATION you can choose to turn cookies off in which
case maintaining state is completely reliant on having the CFID and CFTOKEN
in the URL string (unless you set the cookies yourself).  This can get messy
occasionally if a user bookmarks a page and then comes back later to find
that their information has not been deleted (this could be a good thing). 

2. When using cookies to hold CFID and CFTOKEN you must replace the default
cookies with temporary ones if you wish the client's session to end when
they close the browser.

3. If you are using cookies instead of the DB to store client variable
information you are limited to 4k characters maximum.  The same is true for
DB stored client variables if you are using ORACLE.

4. The minimum timeout for a client variable (system defined) is one day.

I've been using client variables successfully for quite some time.  They are
slightly more difficult to understand and manipulate, but they are reliable,
scalable, and safe (no CFLOCKS).  You would be wise to learn how to utilize
them yourself :)
                                                    
Bryan Love ACP
Internet Application Developer
[EMAIL PROTECTED]
                                                    


-----Original Message-----
From: Andres Leon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 8:57 AM
To: CF-Talk
Subject: Session variables stored in SQL server


Hello all,

I am wondering if anyone has had any experience with this:

I am running a IIS5.0 and CF cluster of 5 servers and one databaser
server (sql70) will upgrade to sql2k soon.

I was adviced by Allaire to move my session variables to the database,
rather than storing them in each server's registry.

My question is: How safe is this in terms of client variables getting
mixed, or users taking other each other's session variables becuase they
would be extracted from one pool, rather than 5?

Is there a performance change by moving these variables to a remote
database? good?, bad?

Any thoughts or ideas on the subject will be greatly appreciated.

Thank you!

Andres
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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