Application deployed on Network/Remote Path – Identifying Network Latency – Improve Performance
Many a time, ColdFusion application code is deployed on a network path when your ColdFusion deployments are of large-scale and mandated to use network paths.
After setting up the server for the first time, if there is any performance hit, as the first thing you would want to cross-check few things. One of the things to determine is if there is any network latency.
Though you would have got same network within your organization same as earlier, your OS version also would have changed.
Follow the steps below to see if the performance hit is due to network latency-
When the server is under moderate or full load(with at least 8-10 requests under process), take 2 or 3 thread dumps with 30 seconds interval.
It is not appropriate to take thread dump when the server has negligible load and anlyze that as there may not be any in-process requests.
If you are not sure how to take thread dump, you can simply follow the following blog.
Open the thread dump file:
Under moderate or full load server conditions, if you see more than 5-8% of running ColdFusion threads containing “WinNTFileSystem” in the thread’s stack trace –> It means that there is lot of time being spent in trying to resolve the application file paths.
Following are the sample threads having WinNTFileSystem in its dump.
"ajp-bio-8014-exec-6861" Id=13898 in RUNNABLE
prio=5 blockedtime=28963 blockedcount=6819 waitedtime=421762 waitedcount=115
at java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
"ajp-bio-8014-exec-6861" Id=13898 in RUNNABLE (running in native)
prio=5 blockedtime=28961 blockedcount=6814 waitedtime=421762 waitedcount=115
at java.io.WinNTFileSystem.canonicalize0(Native Method)
(Note: ColdFusion threads can be identified by the name starting with "ajp-" )
For Example, if there are 50 threads with thread name starting "ajp-bio-" in the thread dump, if you see WinNTFileSystem in more than 2-3 threads, it is the time you start looking at minimizing the network latency.
Once you know there is latency, you would want to know how much is the latency when compared to the application existing locally.
Created a very basic network latency test program to validate this.
You can take the jar from here.
And run it from command prompt as follows:
> C:ColdFusion11jrebinjava -jar <Path of NetworkPathsTest.jar> <Network or Local Directory Path >
If the network path (Ex:- orgserverd$) is accessible only to the ColdFusion service user, open command prompt as that user ( runas /user:<cfserviceaccount domainname>cfserviceusername CMD )
Path Arguments can be one or more. More Path arguments is a good measure to see the difference clearly.
C:ColdFusion11jrebinjava -jar C:ColdFusion11NetworkPathTest.jar orgserverd$deploycfm
C:ColdFusion11jrebinjava -jar C:ColdFusion11NetworkPathTest.jar orgserverd$deploycfm orgserverd$deploycfmapi
Try the same paths keeping the content same on the local machine and see the time differences.
For the same paths on local and remote, the difference in time should not be exponential.
These tests are to be performed on your ColdFusion server machine.
Once you have validations and found any latencies, it is the time to call for network optimization expertise.