CounterMarch Systems

twitter ate my post


We used to blog more before twitter came along.

Scope sync in a cluster

Perennial problem...trying to solve it here without doing TOO much funky work.

Here's the deal:

We're working on a Farcry project. It's going to be deployed to a cluster. Two servers with 2 instances of CF on each. They are cross-paired.

Server1-instance1 is paired with server2-instance4. Server1-instance2 is paired with server2-instance3.

Farcry uses the application scope to cache up a lot of goodies to make the system run faster. This is perfectly acceptable and desirable. Problem is. when the content of the site is updated...how do we force a refresh of the cache in each instance?

First thought was to use an event gateway. Use an extended stored procedure in the database (we're using SQL Server 2005) to make a call to an event gateway that would "do stuff".

Our next move was to look at each other and say "we've never tried that before" followed shortly thereafter by "does that make any sense to push that logic down into the database?"

The next thought was to put a hook in to the fourq database interface code to watch for updates to certain content types. The ones we were most concerned about were refFriendlyURL and config tables. When we detect a change. we'll fire off a cfc method to update a new table in the database with one row per instance containing a bit field ("dirtyFlag").

We'll make a change to Application.cfm in the root of the Farcry site to always do a quick check of that table. Grab the instance running the current request. check the table row for that instance. If the flag is set. update application scope. set the flag back to 0. and then continue on.

Just re-read all that and realized a database trigger on those tables could just as easily set the dirty flags too. Hmph.

Anyone see any issues with this approach? The application scope. if dirty. is updated by each instance as each instance is hit with a request immediately after being set as dirty. Seems efficient enough to me!

Comments
Phil's Gravatar Steve. that is prett much what we do for our Fusebox apps across our 20+ cluster for career sites. We have a flag that is right now in our index.cfm file that will reload the Application scope and Fusebox instance. We're moving them to a configurable setting within our application so us developers don't have to always update that file. :). Anyways. I know your setup is slightly different. but it is the same concept so I see nothing wrong with the approach!
# Posted By Phil | 10/18/06 7:14 AM
Steve Rittler's Gravatar Comforting...thanks!
# Posted By Steve Rittler | 10/18/06 8:39 AM

About the blog

7 years of outstanding software development

CounterMarch Systems is a professional consulting firm specializing in Adobe technologies with a special focus on higher education.

2771 Red Oak Circle
Bethlehem, Pennsylvania 18017
610.280.3455
Contact Us