Feb 23 2013

Important Threading Information For ColdFusion, IIS and Legacy ODBC

Posted by Mike Brunt at 12:48 PM Web Servers | Java-JVM | ColdFusion

 

I am sure the first question that comes to anyone's mind here, is why in Mike Brunt blogging about ODBC, is that long dead and gone?  Well there is a good answer I believe, in some legacy applications it still exists, in medical applications, for instance and where it does still exist, it can be a literal show-stopper if not configured properly thread-wise and this is a deeply hidden problem.  IIS (Internet Information Server) from Microsoft of course is still current and widely used as is ColdFusion.

There is also a hidden "gotcha" with IIS and ColdFusion which certainly pertains to ColdFusion 8 and 9 and possibly 10, although the web server connector is considerably changed in ColdFusion 10.  This article covers a multiple instance install of ColdFusion 9.02, with IIS 7.5 and ColdFusion ODBC support installed also, we will address two underlying configuration files:

ODBC - {drive}:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\db\slserver54\cfg\swandm.ini.  One important part here is a double-check to the path, these are of course Windows install examples so the double-check is this.  Go into the Windows Services MMC- Start > Administrative Tools > Services and locate the ColdFusion 9 ODBC Server service, right-click on it, select properties and make sure the "path to executable" matches the path to the swandm.ini file you are editing.

IIS - {drive}:\JRun4\lib\wsconfig\1\jrun_iis6_wildcard.ini (please note in this case the \1\ in the path is for the first working instance created from the "cfusion" instance created at installation time.  The "cfusion" instance is the only one which can be used to create other instances via Enterprise Manager.  The main point there is that as more instances are added each will get their own directory tree, in others the next instance would look like this {drive}:\JRun4\lib\wsconfig\2\jrun_iis6_wildcard.ini and all will need to be edited as follows.

swandm.ini - archive the existing copy then open the file in a text editor (don't forget to run the editor "run as administrator".  Search for "ServiceMaxThreads" which you will by default is set as ServiceMaxThreads=64.  The next thing to do is to look at the "Maximum number of running JRun threads" setting in ColdFusion Administrator, if that setting is less than 64 you need make no changes, if it is more than 64 then set the ServiceMaxThreads= number to the same as Maximum number of running JRun threads, save the file and restart ColdFusion and ColdFusion ODBC services.

jrun_iis6_wildcard.ini - archive the existing copy then open the file in a text editor (don't forget to run the editor "run as administrator".  You will see these settings like these, obviously the serverstore path and bootstrap information will vary depending on your installation.

verbose=false

Buffer=true

serverstore=C:/JRun4/lib/wsconfig/1/jrunserver.store

bootstrap=127.0.0.1:51000

apialloc=false

#errorurl=url <optionally redirect to this URL on errors>

#proxyretryinterval=600 <number of seconds to wait before trying to reconnect to unreachable clustered server>

#connecttimeout=15 <number of seconds to wait on a socket connect to a jrun server>

#recvtimeout=300 <number of seconds to wait on a socket receive to a jrun server>

#sendtimeout=15 <number of seconds to wait on a socket send to a jrun server>

#maxworkerthreads=25 <number of worker threads created for asynchronous request processing>

The last line "#maxworkerthreads=25" although commented out is actually the default.  So the maximum number of busy threads between ColdFusion and IIS is 25 or 26, the extra thread depends on the minimum thread setting for the web server connector which is 1 by default. The next thing to do is to look at the "Maximum number of running JRun threads" setting in ColdFusion Administrator, uncomment the #maxworkerthreads=25 <number of worker threads created for asynchronous request processing> line remove <number of worker threads created for asynchronous request processing> and set the maxworkerthreads= to the same number as "Maximum number of running JRun threads", save the jrun_iis6_wildcard.ini file and then restart ColdFusion and IIS.  You need to do this for all instances.

In my experience and of course realizing that ODBC is rarely used nowadays; these two threading settings are critical, particularly in the case of IIS because when the thread ceiling is hit and ColdFusion gets into queuing threads in some way or other, performance literally nose-dives very quickly.

I disabled comments here as I get royally spammed and it has brought down the server several times, for any questions or comments you can email me "go2riamb AT gmail DOT com".