Archive for January, 2011

Many people like to use CFInvoke to connect to their object and pass arguments in. However sometimes i believe in the theory that less is more. Being that ColdFusion is now built on a Java platform, ColdFusion has progressively inherited alot of the coding standards into itself. With this has come things like using a ! instead of using NOT, or if you are incrementing a variable for every iteration of a loop you can now use something like <cfset x++> instead of <cfset x = x + 1>. I think these can be cleaner ways and sometimes faster. I digress….

One way that i love to create an object in ColdFusion is by the following:

<cfset variable = createObject('component','NameOfCFC')>

<cfset newvariable = variable.methodiamcalling('argument1=123','argument2=345','argument3=678')>

so now when you reference ‘newVariable’, it will be the information that is returned by the method that was called.

So, if what i am writting is helpful, drop me a line or comment. I would love to hear from you.

Many load balancers now allow you to specify a location of a script to run that will tell the load balancer how busy a particular server is. This is called Adaptive Load balancing. I highly recommend using the Adaptive LB setting rather then Round Robin, or Weighted. Reasoning is that if you have an array of servers, 1 server may be performing a rather expensive task then the others, so you don’t want the Load Balancer throwing traffic at it if it is busy. You want the load balancer to make a decision as to which server is the best able to handle the connection. The ColdFusion script below will access CF JVM memory and report a number 0 – 99 that determines how busy it is. 0 being no connections 99 being busy. any number such as 101 and 102 usually is a reserved number for the Load balancer to know that you want to do a drainstop for that server. So i have an admin that i select a server to remove from the array, and it writes a 102 to a text file that the load script reads an passes on to the load balancer.

Once the load balancer querys that page it sees the 101- or 102 and begins draining connections from that server and pushing the connections to another. Note, that if you have sticky sessions, it may take a while to drain connections based on how long you keep connections persistant.


 <cfif fileExists('#expandPath('\load\adminDown.txt')#')>

<cffile action="read" file="#expandPath('\load\adminDown.txt')#" variable="return">

<cfset returnNum = trim(return)>


<cfset returnNum = ''>


<cfif returnNum EQ ''>

<cfinvoke component="cfide.adminapi.administrator" method="login" adminPassword="password"/>

<cfinvoke component="cfide.adminapi.servermonitoring" method="getHeartbeat" returnVariable="result">

<cfset returnNum = (result["usedMemory"] / (result["usedMemory"] + result["freeMemory"])) * 100>

<cfif round(returnNum) GTE 100>








Multihomed Nics

A couple of weeks ago i had a client call to say that their homesite connection to the FTP server kept dropping or saying it could not connect to the server. When i went to their server everything seemed to work fine for me. As i was baffled by this i decided to wait to see if it was an ISP issue for them.

The next day i receive a call once again they are having problems. I decide to dig deeper into the nics to try and find the issue. To give you a summary of the configuration, the server has 2 nics, 1 that points to the load balancer, and one that is used for connecting directly to using RDC. I found each card had a default gateway assigned to it, but when i went into the command prompt to view the connection properties via IPCONFIG i found that the gateway for the 2nd nic was getting dropped and the routing table was using the gateway of the nic that pointed to the load balancer. This poses a problem because the packet is expected to go out the NIC in which it came in on so the load balancer gets random packets that it did not send to the server, so it rejects it. Causing the server to appear to not respond.

The Fix:

in order to get around this problem i did the following.

1. went into NIC 1 properties and removed the default gateway (load balancer NIC)

2. went to the command prompt and added a persistent route for that NIC in the routing table.

3. restarted server so that it would pic up the only default gateway again.

Windows has a tendency to not like different default gateways for multi homed device. so the way around is to add a persistent route for traffic you want directed somewhere else. Turns out this is not much of a problem usually unless a client is ftp to a site using homesite or dreamweaver. reason why?. high end web tools like those tend to constant contact the ftp server and bombard it with tons of requests, which normally are not a big deal, but if the server takes to long to contact the gateway to send the packet back, and there are 2 gateways defined. It will drop the first gateway assuming it does not work anymore and begin using the second gateway for all traffic.


on multi homed NIC, ALWAYS only define 1 gateway for the traffic. and use your routing table for the rest.

A while back i ran into an issue where our local workstations could connect to our NAS drive at any given time. But for some reason during the evening our SQL DB backups were failing because it did not have access to the same NAS that i was connected to all day. I went onto our windows 2k3 servers and had no issue at all connecting, but as soon as i tried on windows 2k8 i was denied access.

What could possibly be different? Windows 2008 came out with alot of enhancements from stricter security policies to better performance monitoring. If you go to your Administrative Tools/local security policy click on Local policies then click on Security Options scroll to Restrict NTLM: Incoming NTLM Traffic and change to Allow ALL …… Also change Restrict NTLM: Outgoing NTLM Traffic to Remote Servers to Allow ALL. Try connecting to your NAS now. You should not be prompted for login credentials again.

%d bloggers like this: