Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a load balanced cluster of 2 servers for our Coldfusion applications. I'm encountering some weird behavior, and would like to find out which of the two servers a user is currently on when they are running the web application. Is there a way to find out which server is being used for specific requests?

The cgi.server variable only provides info like and what I need is, or

share|improve this question

You can get the CF Instance name using this: #GetMetricData("PERF_MONITOR").InstanceName#

The problem is that you probably don't have the metrics service enabled, since it is disabled by default on the Enterprise editions. I wouldn't be surprised if there is another way to get the instance name as well.

share|improve this answer

If you have a standard header include, perhaps output the server name as an HTML comment. This would mean a slightly different file on each server, but may help you track down the issue for troubleshooting. If the header file must be the same, add code to include or read from some other file that can be different, perhaps outside your webroot if the two servers have the webroot synchronized regularly.

share|improve this answer
That's a good idea. I suppose I could tell the sysadmin to put a small xml file on each server, and have a single element in it say the full name of the server. On each request, I could have it look up the file, parse the text, and attach the value to my error report emails. Do you think that would do the job? – David Csonka Aug 27 '09 at 12:46
It very likely would, yes. – Justin Scott Aug 30 '09 at 6:04

If you want to do it without adding extra content to manage on the servers, you could programatically get the host names of the server ColdFusion is running on. This will be unique ot each node of the cluster.

<cfset hostName=CreateObject("java", "").localhost.getHostName()/>

This is discussed over on StackOverflow:

share|improve this answer

I have a simple application I used to test session stability, failover, and replication in ColdFusion clusters. You can download from my blog here:

This test reports which instance your request is on, and if the server instance or session token has changed such as during failover. And if the session recovers after failover back to the originating server then it will indicate that too.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.