Greg's Blog

helping me remember what I figure out

CFMX 6.1 and JVM Memory Settings

| Comments

In my development set up I run CFMX as multiple instances. Why? Well the first mirrors our staging environment and is the one I use primarily for development. The other two are used one to test Flex and secondly to test/implement external jar files (such as changing the SAX parser to name an example). Since my machine has a 512 Meg of Ram and that is the default JVM setting for CFMX I felt I needed to change this to something reasonable for development as well as maintain a degree of flexibility, i.e. be able to assign different instances different JVM settings. The key to doing this is to modify your jvm.config file and create one for each instance in question. What follows is a step by step guide to doing this and instructions on starting up your CFMX instances with their specific jvm.config files.
  1. locate your jvm.config file, it is usually located under {install Path}Jrun4/bin/
  2. create as many copies of this file as there are instance you want to associate a unique jvm.config to. Give that copy a name that reflects the name of your instance, I usually choose: jvm.config_instanceName
  3. open a copy and look for the following section: # Arguments to VM java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -Xbootclasspath/a:”{application.home}/servers/yourInstanceName/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/webchartsJava2D.jar” -XX:MaxPermSize=128m -XX:+UseParallelGC -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS
  4. You can see that the default setting for the memory allocated is 512 Meg. I want to change this to be the same as the MaxPermSize (i.e. 128 Meg). This is what the modified line looks like:# Arguments to VM java.args=-server -Xmx128m -Dsun.io.useCanonCaches=false -Xbootclasspath/a:”{application.home}/servers/yourInstanceName/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/webchartsJava2D.jar” -XX:MaxPermSize=128m -XX:+UseParallelGC -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS
  5. In order to start up this instance with it’s own jvm.config file I use the command line. You can use the service window, but I found that it doesn’t appear to remember my configuration, so I rely on batch files. Here is the command to start up the instance:$ cd {install path}Jrun4/bin $ jrun -start -config jvm.config_yourInstanceName yourInstanceName & This tells JRun to start up the yourInstanceName instance using the config file: jvm.config_yourInstanceName. Once you see a message like the following: Server yourInstanceName ready (startup time: 31 seconds), you are ready to use your tailored CFMX instance.
  6. simply repeat for each and very instance you want to apply this to.
That’s all there is to it really. There are a number of resources on the topic (simply do a Google search on: jvm+cfmx instances), including (shameless plug) an article I wrote for CFDJ on my experiences using instances.
UPDATE
Doug Knudsen posted a message to CF-Talk showing how you can enable the separate config if you are using the windows service. When configuring the service simply type this: [code]jrunsvc -install yourInstanceName “your service instance name” “Some description” -config jvm.config_yourInstance name[/code] Marvellous thanks Doug!