Accessibility

ColdFusion Article

 

Taking advantage of 64-bit support in ColdFusion 8


Table of Contents

Java and 64-bit

Now that I have discussed enough of what 64-bit systems provide, let's get specific and check how ColdFusion benefits from being a 64-bit application. First of all, remember that ColdFusion is a Java application; thus, it is important to understand the implications of 64-bit computing on Java.

Sun first introduced a 64-bit version of Java for their Solaris operating system on SPARC processors with Java Development Kit (JDK) 1.4. The JDK 1.5 and JDK 1.6 releases introduced support for the x86-64 processors made by Intel, these processors are widely used by Windows, Linux, and Mac OS×operating systems today. The main implication of 64-bit in Java relates to the heap space used by Java applications and the algorithm used for garbage collection of the objects created on the heap, which I will discuss in the next few paragraphs.

When a Java application executes and creates objects, the objects are stored in a place called heap. The amount of heap space an application can use depends on the operating system, the amount of RAM available in the system, and the amount of memory that the hardware can address. A 32-bit system, as discussed earlier, can support a maximum of 4GB memory. But not all 4GB RAM space is available for use by a single Java application. For instance, an OS uses some of the RAM space. Assuming that the hardware has 4 GB RAM, the maximum heap space a typical application can use would be 1.2 GB to 2 GB. However, this limit is not true for Java applications on a 64-bit CPU system. The value that you can set for the maximum java heap space on a 64-bit CPU system is only limited by the limitations of hardware and the OS (as discussed in the previous section).

You can increase or decrease heap space for Java applications by changing the Xmx value in your Java command line arguments ( also called Java args). In ColdFusion, you can configure Java args in jvm.config, a ColdFusion proprietary file that resides under the<ColdFusion_Root>\runtime\bin folder on standard server installations. On multi-server and JRun deployments, you can find the file under the <jrun_root>\bin directory. On our 32-bit lab machines, we were able to set the Xmx value to a maximum of 1280 MB. When we increased the Java heap space Xmx value to more than 1280 MB and started ColdFusion, the server threw the following error message: "Error occurred during initialization of VM. Could not reserve enough space for object heap." Running ColdFusion as 64-bit effectively removes this limitation.

With the availability of large heap space, large-scale ColdFusion applications (or ColdFusion applications that are memory intensive) can load all the data it needs into memory (caching) as part of boot-strapping effectively reducing the disk/database access that are usually costly. However, large heap space isn’t always a benefit. The memory given to the objects that are created on the heap need to be retrieved once the executing program does not reference the object anymore. Java does this on a separate thread and is called garbage collection. Garbage collection happens at certain intervals of time during the execution of the Java application. As the heap space increases, garbage collection may create large pauses in Java applications if it is not tuned properly. According to the Sun Frequently Asked Questions (FAQ) about Java:

The Hotspot VM comes with a number of garbage collection implementations some of which are targeted at Java applications with large heaps. SUN recommends enabling one of the Parallel or Concurrent garbage collectors when running with very large heaps. These collectors attempt to minimize the overhead of collection time by either collecting garbage concurrent with the execution of the Java application or by utilizing multiple CPUs during collections to get the job done faster.

ColdFusion uses the Throughput/Parallel garbage collector as the default collector for server and multi-server installations and it is enabled by having -XX:+UseParallelGC in the Java arg in jvm.config. For more information on these garbage collection modes and how to select them, refer to the Hotspot garbage collection tuning guide: Tuning Garbage Collection with the 5.0 Java Virtual Machine.