2

So, the title pretty much says it all: I'm switching from a single-server ColdFusion install to a multi-server ColdFusion install, and session replication does not work if I set the application name.

Here's a stripped-down application.cfc that does NOT replicate sessions successfully.

    component 
    {
        this.name                = 'myTestApp';
        this.sessionManagement   = true;
        this.sessionTimeout      = createTimeSpan(0,2,0,0);
    }

As soon as I comment out the application name, session replication works perfectly between my servers.

I believe this Adobe help page tangentially references the issue:

If you do not specify an application name in the This.name variable in the Application.cfc initialization code or by using the ColdFusion cfapplication tag, the application is unnamed, and the Application scope corresponds to the ColdFusion J2EE servlet context. ColdFusion, therefore, supports only a single unnamed application.

If multiple cfapplication tags and Application.cfc files do not specify an application name, all pages in these applications share the servlet context as their Application scope. All sessions of unnamed applications correspond directly to the session object of the J2EE application server. (If you do not use J2EE session variables, ColdFusion ensures that the J2EE session lasts at least as long as the session time-out.)"

It's obviously not regarded as a best practice to stop using application.name. But how do I enable my servers to make sessions available when using named applications? Is there a way to register the application name in the J2EE/JRun servlet context? I'd hate to set up a separate instance cluster for every CF application we're running on the server; that hardly seems like an scaleable solution.

I feel like I'm probably missing something drastically simple here, not being a java guru, but any tips are appreciated.--Will

Leigh
  • 28,765
  • 10
  • 55
  • 103
xweb
  • 123
  • 1
  • 1
  • 8

2 Answers2

2

We have configured a number of clusters using ColdFusion (J2EE) clustering and have gotten Session Replication running reliably and always with a defined ColdFusion Application. There is no doubt that in versions 6.1 through 8 this was very challenging, things certainly got better with CF9. However, clustering ColdFusion is not a simple point and click exercise, it needs to be created carefully; starting with multiple instance creation on all servers; at that point a check to ensure each instance is serving content individually, as expected; then we can create the cluster(s) add members (the recently created and tested instances).

Our recommendation is to set "round-robin" with "sticky sessions" however we have successfully enabled clients to use round-robin only. At every stage in this process it is important to restart all instances each time a change or addition is made and the {instance}-out.log should be checked after each restart to ensure there are no errors relating to the cluster as is well stated by Barney in this thread. Only when there are no clustering errors in the {instance}-out.log's is clustering working correctly and do not make any judgements or assumptions until the cluster(s) are completely configured.

Leigh
  • 28,765
  • 10
  • 55
  • 103
Mike Brunt
  • 21
  • 1
0

Here's a few thoughts:

  • Do you have J2EE sessions enabled on both CF instances?
  • Are your CF servers both on exactly the same version of CF & JRun?
  • Are they running the same version of Java?

Is anything shown in JRun or Coldfusion's logs?

I would expect that if sessions are failing to replicate, then you'd see mention of it in the logs. We gave up on session replication in JRun/CF due to reliability issues (mainly with high numbers of cluster members), but we did have it running with an app which had an application name, so I know it's possible.

barnyr
  • 5,678
  • 21
  • 28