Author: Steven Neiland
Published:

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

When you create a multi-instance Coldfusion cluster one of the things you should be aware of is the jvm.config file. This file configures the jvm that coldfusion will use such as the path to the jre folder and the arguments passed into the jvm when the coldfusion service starts.

When you create a new coldfusion instance all the files and settings of the master instance are copied... except the jvm.config file. This means that any changes made here are used for all instances of ColdFusion. On the face of it this seems like a good thing. However there are two problems with this.

Note: The jvm.config file exists in "c:\JRun4\bin"

Problem 1: Shared Memory Settings

If your jvm.config specifies 1Gb of memory allocation, each instance of Coldfusion will be setup to use 1Gb each. So on a machine with 6 instances of CF running (plus the Coldfusion Administrator) you will have up to 7Gb of potential memory usage.

Further all CF applications have different memory requirements. For example why should a 5 page Petshop site be allocated the same amount of memory space as a 200 page online trading site?

Problem 2: Logging Ports

If you want to hook up an external logging/monitoring tool such as jConsole you need to specify a port number to use in the jvm.config file. However as each instance uses the same config file this leads to each instance of CF trying to output to the same port number.

Note: While you can setup the logging port to bind to the next available port number, this makes it impossible to know what port is being used by which CF instance without some unneccessary legwork.

Solution: Create Individual "jvm.config" Files

The process of creating individual jvm.config files is fairly straight forward.

  1. Backup your original jvm.config file. This file will continue to be used by the coldfusion administrator so its a good idea to keep a backup.
  2. Create a new jvm.config file for each of your coldfusion instances by copying the current jvm.config file. I use this naming convention for my new config files "jvm_[instance name].config" .
  3. Open the services control panel and search for the list of Coldfusion instances. On CF 7 the services will be named "Macromedia ...." services. On CF 8+ the services will be named "Adobe ColdFusion ....". These are the instances of Coldfusion running. My services were named "Adobe ColdFusion 8 AS cf1" & "Adobe ColdFusion 8 AS cf2".
  4. De-register each of the instances from the services list
    >cd c:\Jrun4\bin
    >jrunsvc -remove "Adobe Coldfusion 8 AS cf1"
  5. Next we re-register each instance but specifying the new "jvm.config" file. Note the repetition of the "Adobe...." is intentional.
    >jrunsvc -install [instance name] "Adobe ColdFusion 8 AS [instance name]" "Adobe 
    ColdFusion 8 AS [instance name]" -config jvm_[instance name].config
  6. F5 the services list and you should see your service. Try to start it. If you get an error go look in the jrun4/logs directory for the [site name]-out.log and the [site-name]-err.log.

And there you have it. Each instance of ColdFusion has its own jvm.config file.

Note: You can specify some instances to use the same config file if you want. This might be useful if you have two clusters and you want each instance in cluster 1 to use one config file and each instance in the other cluster to use a different one.

Addition Resources

If you want to read up further on the "jrunsvc" command checkout the Adobe Live docs
http://www.adobe.com/livedocs/jrun/4/JRun_SDK_Guide/apis4.htm.

Related Blog Postings

What Do You Think?

Reader Comments

Post a Comment

Comment Etiquette:

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain or appear to be advertisments, will not be published.
  • Comments that appear to be created for the purpose of linkbuilding to commercial sites will be removed.

We are all adults here so play nice.

*
*



Archives Blog Listing

Tag Listing

Learn CF In A Week

Treehouse

 
Fork me on GitHub