ColdFusion servers
The WES team, in collaboration with the ColdFusion team, in the Data Centre provide the following services:
- Web development server - IIS 4, CF 5.0, Windows NT 4 SP6a
- Staging server IIS 5, CF 5.0, Windows 2000 SP2
- Production server, IIS 5, CF 5.0, Windows 2000 SP2 NLB cluster
An NLB cluster is a set of machines running identical copies of an application; requests are sent to the servers in the set in such a way as to balance the load. To maintain session state, a client will be sent to the same server every time.
Access
Using Windows file sharing, you will be given CHANGE access to from one to three folders, one for web pages, one for custom tags, one for cffile uploads. The share used for CFFile uploads should also be used for the output of scheduled tasks, or any other case where the web writes to files. You will not have access to the CF log files because the content is often confidential. We need to know the domain\username of the people who are allowed to update the folders - to simplify the administration of this list, we ask you to create a global group in your domain containing the accounts; we link to this group from the CWRD domain. On the development and staging service, the shares point to the live files used by the web server. On the production service, the web pages share and the custom tags share point to a distribution folder - any changes made to files in this folder will be copied to the web servers on the cluster machines at 08:30, 12:00 and 18:00 each day. Urgent changes can be applied immediately by sending an email to ADMIN-DI-DC WES (during normal working hours) and asking for a WebDist. Note that the distribution process creates mirrors of the distribution folder.
Restrictions
- Don't use absolute links, or root relative links to pages in your web (ie links that start with a /).
- CFFile tags should refer to your CFFile share, not to files in your web space
- Don't put things in your custom tags that need a CF server reload to change - the server runs non-stop for years.
- Be aware of the cluster - although each client will always run on the same server in the cluster, not all your clients will be on the same server.
- If you are generating filenames for uploaded files, remember that it is possible that more than one server will be generating a name at the same time - if you call your files after the date and time, then you WILL have two users trying to create the same file at some point.
- Make sure your scheduled tasks only run on one node of the cluster - see the example script in the techniques paragraph.
Techniques
These will run on every node of the cluster, which is probably not what you want. One solution to this problem is to use a database record with a lock to force a single process to execute the task. An example of this has been provided by Stephane Beherlet of Ariane-2. This method is a good one to use, as it will work on the test server, which is not configured for clustering.
<!--- We use a CFtransaction to be
able to lock the record using a select for update which
is unlocked by a commit or a rollback. Using the
nowait, the next process does not wait for the record
and stop.
We set the date of the day, as long as our process is
suppose to run once a day.
We test if the date of the day is different then we
put a pointer (dejaxexcute) to YES in case the date is
the same otherwise is set to NO
Note that this operation must be in a CFTRANSACTION
TAG
This code is valid assuming that you have a schedule
task set on your CF server and was made to avoid twice
the same tasks to be started
--->
<cftransaction ACTION="BEGIN">
<cftry>
<cfquery NAME="sel_lastrun"
DATASOURCE="#db#">
select
trunc(sysdate)-trunc(to_date(st_value,'dd/mm/yyyy'))
diff
from com_gen_environment_t
where ST_SIC_ABBREV = 'MIS' AND
ST_ADDITIONNAL_INFO = 'LOADER_MIS' AND
ST_FIELD_NAME = 'ST_LASTRUN'
for update of ST_VALUE nowait
</cfquery>
<cfcatch TYPE="Database">
<cfset dejaexecute = "YES">
<cftransaction
ACTION="ROLLBACK"/>
<cfif mode_debug eq "Y">
<br><B>Erreur Capturée
:
<CFOUTPUT>#cfcatch.message#</CFOUTPUT></B><br>
</cfif>
</cfcatch>
</cftry>
<cfif dejaexecute eq "NO">
<cfloop QUERY="sel_lastrun">
<cfif sel_lastrun.diff gte 1>
<cfquery NAME="upd_lastrun"
DATASOURCE="#db#">
UPDATE COM_GEN_ENVIRONMENT_T
SET ST_VALUE =
TO_CHAR(SYSDATE,'dd/mm/yyyy'),
DT_UPDATE = SYSDATE
WHERE ST_SIC_ABBREV = 'MIS'
AND ST_ADDITIONNAL_INFO =
'LOADER_MIS'
AND ST_FIELD_NAME =
'ST_LASTRUN'
</cfquery>
<cftransaction
ACTION="COMMIT"/>
<cfelse>
<cfset dejaexecute = "YES">
<cftransaction
ACTION="ROLLBACK"/>
</cfif>
</cfloop>
</cfif>
</cftransaction>
<cfif dejaexecute neq "YES">
<!---
****************************************************************************
Insert your code here
****************************************************************************
--->
</cfif> <!--- end isdefined dejaexecute
--->