I did it once long ago when I was still a developer, it was probably on CF5
or 6.
I will presume Windows is used here, if not, just translate tot he Unix
equivalents.
It is basically just a file server, network attached storage, a SAN or
whatever you have available.
You MAP a drive on your web servers to that NAS.
You will need to run CF under a user account (not system) so it has access
to mapped drives, but you should be doing this anyway for security.
Now you simply have some code in your application.cfc or wherever is
convenient which serializes a users SESSION scope to WDDX or JSON and
stores it on that mapped drive whenever something changes.
Then OnSessionStart, you look for that file (based on the sessionID in the
cookie), and load in the session scope and serialize it.
This will handle server restarts, crashes and failover to different servers
as well as the file will get loaded if it exists.

This also allows you to keep your sessions alive for much longer without
having to store them in memory, or if you don't want to do that, just have
a schedule which deletes any files with last modified times older than your
desired session limit.

The updating of the session file may be the tricky bit, as you will need to
update any code which writes to the session scope. The way I did this back
then was to have a <CFSession> custom tag or function which would do the
session read/write and then serialize and re-save whenever a write occurs,
or if your code is more modern this would be a config bean of some sort.

I did load test this solution at the time and it made no noticeable
difference to performance. I'm pretty sure I also compared saving to files
vs saving to a database as well and saving to files performed better.
Although nowadays you could probably use a NOSQL solution such as MongoDB
instead.




On Mon, Nov 18, 2013 at 3:56 PM, Brian FitzGerald
<[email protected]>wrote:

>
> >If you use a centralised storage for all servers in your cluster then it
> is
> >easy.
>
> Russ, thanks a lot for your response (somehow I missed it last week). I
> read the article you linked to about client variables (good read). Are you
> aware of any resources which discuss how one might implement a "centralised
> storage" setup like the one you describe?
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357105
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to