The amazing adventures of Doug Hughes

I am slowly publishing a series of blog posts relating to clustering in particular with ColdFusion and JRun. It can get fairly complicated pretty fast and I urge all who are going to embark on clustering to plan out how you want to cluster and why. Another key issue is to make sure when we are creating a web application that it designed and engineered from day one with clustering in mind. I have helped so many clients who hit major problems when they start building clusters, largely because the application was too tightly coupled to the environment it is running in. Hard-coded directory paths would be a classic example.

In this blog posting I wanted to illustrate an interesting concept, well two in reality, Horizontal Clustering and Vertical Clustering. This was prompted by a comment from someone on another blog piece I did on clustering, here. In this first graphic we have Vertical Clustering…

Vertical_Clustering

In this case we are running “RoundRobin” with “Sticky Sessions”. What this does is cause the Hardware Clustering Device to send User 1 to the first web-application server and they stay there for the duration of their session, unless that web-application server fails. User 2 is sent to the second web-application server and they stay there for the duration of their session, unless that web-application server fails. At the software level, via CF-JRun exactly the same procedure is taking place.

Next we have an example of Horizontal Clustering…

Horizontal_Clustering

In this case we are running “RoundRobin” with “Sticky Sessions”. What this does is cause the Hardware Clustering Device to send User 1 to the first web-application server and they stay there for the duration of their session, unless that web-application server fails. User 2 is sent to the second web-application server and they stay there for the duration of their session, unless that web-application server fails.

At the software level, via CF-JRun we have two clusters which actually span the two web-application servers in some ways usurping what the Hardware Clustering Device is doing. User 3, for instance, can actually be served by the second Web Application Server if “RoundRobin” is enabled at the Software Clustering level. In this sort of set-up, we have the Hardware Clustering Device performing more of a fail-over role whilst the Software Clustering is slanted more toward load-balancing.

In both cases it would be good to have Session Replication enabled and in the case of Horizontal Clustering it is essential or Client Variables could be used but of course complex objects cannot be stored as Client Variables. I hope to cover this concept in greater detail as I go through the series in HA and clustering with ColdFusion-JRun. As I stated at the beginning of this piece, careful planning with an eye to the future is essential when building any sort of cluster.

Comments on: "Vertical and Horizontal Clustering with ColdFusion" (23)

  1. Gary Fenton said:

    We use horizontal clustering just like in your diagram, but I had no idea it had the name “horizontal” clustering. We use Windows NLB (network load balancing) instead of a physical clustering device.

    CF is set up as round robin but traffic is weighted slightly more to one specific server. Traffic is low compared to what it’s capable of handling so we suspect a more even distribution is only done when traffic levels get higher.

    We’re upgrading to CF8 soon and that gives us a chance to redo the clustering so I’m keen to pick up some fresh insight from your blog.

    Like

  2. Mike Brunt said:

    @Gary, thanks for taking the time to comment and also for giving us some insight into how you are set up. I actually did some work with Microsoft NLB back in Windows 2000 days and found it tough to set up. Are you on 2003 Gary and if so, do you have any thoughts as to how you like NLB?

    Like

  3. Gary Fenton said:

    I didn’t personally set up NLB on our servers, my network guy did it. The reasons we used it were, if I remember, it’s much cheaper to do it in software (obviously!), it’s integrated well with IIS and SQL Server, and it’s reasonably easy to set up in Windows 2003 – it’s no longer an add-on but properly integrated and evolved.

    What’s new in NLB in Win2003: http://www.microsoft.com/windowsserver2003/evaluation/overview/technologies/clustering.mspx#ERD

    It hasn’t given us any problems whatsoever in the past 2 years it’s been running. In fact we haven’t even mentioned it once since it was set up. I think that’s a good thing. No, a VERY good thing.

    Like

  4. Mike Brunt said:

    Thanks Gary, yes it is a very good thing and I think it worthy of more investigation, here at Alagad.

    Thanks for posting this comment and good luck with your CF8 upgrade. So far we have found the move to CF8 with clients to be a great upgrade. I think in the whole area of Clustering – HA there needs to be more detailed documentation and hopefully we can help a little.

    Like

  5. Gary Fenton said:

    @Mike, we were kind of holding off on the CF8 upgrade to see some results from your experiments first. 🙂 We have a 4 hour window at night to do it and are keen to learn of any issues or interesting findings beforehand. You’re right that docs are a bit thin on the ground.

    Like

  6. Mike Brunt said:

    @Gary NP at all we will be publishing on that soos, one thing I can say is that the CF8 Enterprise Manager-Instance/Cluster Manager GUI seems to be quirky sometimes; more on all of this shortly.

    Like

  7. Mike Brunt said:

    @Gary sorry about the typo -“Gary NP at all we will be publishing on that soon”

    Like

  8. Steven Wood said:

    For the time being, we are only interested in same-server (vertical clustering) of mirrored CF instances… mostly because it is so incredibly easy to set up.

    1) Create a CAR of your target instance (MySite).
    2) Create a new CF instance and deploy your CAR file on it (MySite2).
    3) Cluster Manager > Create New Cluster (MySite_Cluster)
    4) Add MySite and MySite2 to MySite_Cluster.
    5) Restart both instances.
    6) Use WSConfig tool to disconnect MySiteWeb (IIS) from MySite (CF).
    7) Use WSConfig tool to connect MySiteWeb (IIS) to MySite_Cluster (CF Vert Cluster).
    8) In IIS, reset index.cfm as default, add CFIDE virtual directory.
    9) Done.

    It’s a 10 minute procedure.

    This worked perfectly for us in our Dev environment. However, last night we attempted to apply vertical clustering to our production servers and it was a complete failure. After the cluster was established I watched as the instances spontaneously restarted themselves a couple of times and then stopped. After a bit of wrangling and trying different things, we decided to pull the plug on the procedure and check the logs.

    We are confused in that production acted quite differently from development. Scratching our heads.

    Steve

    Like

  9. Mike Brunt said:

    @Steve, thanks for this insight and yes I think .CAR files are great for replicating repetitive entries where everything will be literally exactly the same on all instances. Exactly the same as the settings we save in the .CAR file.

    I think what might have happened is this, if you attempted to use the same .CAR file in Production from Dev you may have paths and class paths that are different, this is a guess.

    If this is not the case, you did not usethe same .CAR email me the {instance}-out.log to mbrunt at alagad dot com.

    Like

  10. Steven Wood said:

    I think I worked out the problem. Even though we are implementing vertical (same-server) clustering independently on 2 different physical servers, each cluster needs to have a UNIQUE NAME!

    Apparently, even though the 2 clusters have nothing to do with each other, they are aware of each other and get confused if they both have the same name.

    Knowing this, we are going to attempt clustering in production again tonight.

    Cheers!

    Like

  11. Mike Brunt said:

    @Steve this is good news, congratulations. I hope all goes well with your setting up of Production; if you get the time you should let us know.

    Like

  12. Helge Hetland said:

    I’m also trying to get clustering on 8.01 and IIS working.

    I have 2 servers with 2 instances on each.

    Working nicely with sticky sessions, but not at all with session replication.
    Looking forward to your entries and hope to find some answers to my issues. (and will comment on my progress)

    Thanks,
    Helge 🙂

    Like

  13. Mike Brunt said:

    @Helge, thanks for sharing your issues here and I hope we can help. When you say you are having problems with sharing Session variables is that between each instance on a single physical server or between instances on different physical servers?

    Like

  14. Helge Hetland said:

    I’ve tried different setups:
    1 instance on each physical server
    (And the other instances stopped, or in another cluster), 2 instances on a single physical server and all 4 instances in one cluster.
    And I’ve also tried to change the different ports on the instances to see if that could help, but I keep getting the “Setup of session replication failed” message in the logs for the instances.

    We run a coyote equalizer loadbalancer in front of the servers.

    Like

  15. John Jarrard said:

    Hi Mike,

    I’m having what sounds like the very same issue Helge is having. Did you ever find out what was causing his problem?

    I basically have two distinct sets of sessions on each server and if one goes down, half my folks get the boot.

    I have it setup with two instances on the same physical box. Both Sticky Session and Session Replication boxes are checked.

    I sincerely appreciate any guidance you might offer.

    Like

  16. Helge Hetland said:

    Hello,

    I think I’ve found out where some of us get into problems with clustering:

    Disable the internal webserver, it disturbs session replication…

    I’ve been using the internal webserver for administering the servers, and never tought that that would create problems with clustering.

    But today (in “desperation” I might add…) I tried to disable the internal webserver and all my problems went away.

    There is no need for the internal server in production as It’s easy to add the instances to IIS if needed.

    And all the manuals says “not recommended for production use” but in cluster manager in CF8 the internal server is enabled by default when creating instances, so I’ve never given that a tought before..

    Hope this helps someone – I’ve used countless hours on this.. lol

    Greetings
    Helge

    Like

  17. John Jarrard said:

    Hi Helge,

    Did you say it is easy to configure the management sites in IIS? Would you mind posting instructions?

    Thanks,
    JJ

    Like

  18. Helge Hetland said:

    Sure,
    There’s at least 2 ways to do it, separate url’s or separate port adresses.

    (This is for iis)

    – Add a new website name it “cfadmin1” or whatever.
    – Enter a distinct host header address, or a distinct port address.
    (I used port adresses 8301 / 8302 etc.)
    – The directory to point to is:
    [drive]:JRun4servers[instance name]cfusion.earcfusion.war

    Repeat for every instance

    Now you should be able to access the admins via your website url

    Hope this helps 🙂

    Like

  19. Helge Hetland said:

    Hello,
    My above description was not quite correct, at least not for our situation. – in our case we’ve set up the jrun connector to serve all iis websites. That means that all websites on the server gets clustered -and I’m unable to access a spesific instance.
    (If we didn’t use the connector this way I guess I would be able to use the connector on the separate mgmt sites.)

    Not an option with 100+ IIS sites on the servers..

    We solved that by using apache to connect to the separate management sites.
    That is working just fine. I guess it would also be possible to do some magic in some of the configuration files for jrun/cf to accomplish the same thing.

    Maybe even in the configuration for the builtin webserver to make it “behave” together with IIS and session replication..

    -Helge

    Like

  20. Helge Hetland said:

    Hello Again,

    After configuring my servers as I described above I’ve notices that It’s not working as I expected.
    -I’m unable to access my admin interfaces as they are clustered as well.

    (But disabling JWS still makes session replication work.)

    I’ve submitted a support case to Adobe and hope they can shed some light on this..

    -Helge

    Like

  21. John Jarrard said:

    Hi Helge –

    I have configured as you suggested in IIS, however, when I hit the various sites (Port 8301, 8302, etc…) they all show “serverOne” once you login.

    http://www.yaddyya.com:8301/cfide/administrator >> serverOne

    http://www.yaddyya.com:8302/cfide/administrator >> serverOne

    http://www.yaddyya.com:8303/cfide/administrator >> serverOne

    It should say “serverTwo for 8302” and “serverThree for 8303″…

    Do you have any idea why this might be happening?

    JJ

    Like

  22. Helge Hetland said:

    Hello,
    One of my developers have made a solution that helps us connection to the instances we need.

    The thing is to “trick” CF to use a spesific server in the cluster, and then access CF admin. This is done by setting a cookie (jsessionid) and with a refresh of the page the cluster switches to that particular instance.

    See if the following code works for you (The code is complete – just change your urls and your jsessionids to test)

    CF Admin for cluster

    Home

    Select your serverinstance:
    Server 1 (a030)
    Server 2 (d230)
    Server 3 (2e30)
    Server 4 (9230)

    To CF admin (#Left(cookie.jsessionid,4)#)

    document.location.href = “index.cfm?resend=1”;

    document.location.href = “index.cfm?toadmin=1”;

    Like

Comments are closed.

Tag Cloud