On 11/11/05, Mehdi, Agha <[EMAIL PROTECTED]> wrote:
> One more thing. What is the best way to manage Sessions in a
> clustered environment?

I'll touch on this topic for you because I have ran into the very same
problem myself. (for the record, I think AJAX/iFrames would work best
bet for you other problem, but I think everyone else has covered that
well enough already).

We have a clustered production environment too. I've been working with
our IT guys to set it up so that users get "bound" to a specific
server, based on a cookie. This works OK for us because the parts of
the site that requires sessions, also requires cookies. However, there
are still times when a session could be lost (the server reboots), so
I often still implement some sort of in-code back-up process to
recover the user if the session is lost. Something along the lines of
storing a client variable indicating their session ID or something.

For example, I'm using a singleton pattern for some of my components
(http://en.wikipedia.org/wiki/Singleton_pattern). So in my
getInstance() I check to see is a session variable for that
component's instance exists, if it does, I return it. if not then I
check the the client variable does; if so, I use that to pull the
session information from SQL or something. If neither exists, I run
the init() method, storing the object in the session scope for future
access (and a serialized version in SQL via an asynchronous CF gateway
call). This seems like a lot of work, and well, it is. But I only have
to do it once, and then I can basically copy/paste from then on for
other components. This allows me to use the session scope for quick
access to the users information, but still have a recovery process if
something unexpected happens.

This is of course just one way to handle such a problem, I am sure
there are many others too. The best way to handle a problem like this
depends heavily on your specific scenario.

Hope that helped

--
Rob Blackburn
http://www.rbdev.net

PS: Serializing a CFC object is a custom method too, because
macromedia did not make components nativity serializable, which is a
royal pain the the ... .


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to