Search code examples
coldfusioncluster-computingrackspace-cloud

ColdFusion and Cloud Cluster Load balance sessions


So i'm trying to move my application to the cloud, specifically im using RackSpace and so far so good, got everything to point X and find that the load balancer doesn't offer stick sessions via https.

Searching further it seems that Amazon doesn't do this either.

Clearly I need to either maintain a user on a server or somehow share session data across instances.

I considered doing a hard redirect to the server you land on, however that would be bad as if bookmarked the user will stay on that server.

Any suggestions.


Solution

  • You could use client variables, rather than session variables. The difference is client variables have to be simple name=value pairs, but also they can have different storage locations that may suit your request. Depending on your need, you could choose to store the values within the browser, via "cookie storage", or within the database. You can choose how client variables are stored in coldfusion administrator. Either one of these options shifts the storage off of the particular application server instance, which is what you need for simple clustering. Choose cookie-based if you don't care much about the security of the particular values; choose database if that is a concern. Obviously, if you choose database, you'll need to configure all app servers to point at the same database.

    edit

    I didn't realize you were talking about an existing app. Yeah, that would certainly be a problem. In that case, what you would need to do is configure your load balancer to associate a given CFID and CFToken (read from the cookies) with a particular node in your cluster. This way the "stickiness" is transparent to the end user, and will only last as long as the session.

    edit

    Yet again, based on your comments - since you have the Enterprise edition, you could use the built-in clustering provided by that version. Here's an article discussing that feature - http://www.adobe.com/devnet/coldfusion/articles/clustering_cf8.html

    Scroll down a bit until you get to the "Clustering and ColdFusion" section - that has good information on it.