Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion Garbage Collection

We have 6 Windows Server 2008/IIS 7.5 ColdFusion 9.0.2 servers on a round-robin load balancer. Each server is allocated 2GB for ColdFusion. Servers have 6GB of memory total. Garbage collection seems to be an issue across all the servers but I'm not sure how to resolve the issue without recycling ColdFusion.

The graph below is the AVG/MAX memory for our 6 servers over the past few days. Each day the AVG memory increases. Eventually, the servers start queuing requests (because they can't process them fast enough) and we have no choice but to recycle.

Data taken at 1m intervals across all 6 servers.

The data in the graph was taken from 1m snapshots of FusionReactor across all 6 servers.

Our servers are using the following command line in jvm.config for ColdFusion:

java.args=-Xmx2G -server -Xms2g -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/ -Djava.security.policy={application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/coldfusion.policy -Djava.security.auth.policy={application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/neo_jaas.policy

I'm not sure if changing garbage collection parameters is the solution, and I know nothing about GC especially as it relates to ColdFusion.

I'm aware this may have something to do with the code on the site. It's a portal (something like fusebox) that hosts many different applications inside of it. There are NOT many uses of cfobject calls in the portal.

like image 922
Brad Avatar asked Feb 07 '26 13:02

Brad


1 Answers

This is similar to this question: Coldfusion OutOfMemoryError (CF9/Wheels)

But let me highlight the ones that are relevant for this:

  1. Make sure you are on at least CF 9.01hf4 or 9.02hf1 and run ColdFusion on Java (See ColdFusion 9.01 on Java 7)

  2. Bump up the `-XX:MaxPermSize=512m

  3. Use -XX:+G1GC (See Is JDK 6u14 Garbage First (G1) garbage collector, suitable for JRun?)

  4. Make that the JVM can use 4GB

  5. Every 100 to 1000 iterations do a strongly suggested Garbage Collect

  6. Make your function silent

  7. Make sure that variables in functions are scoped to var or local

  8. Consider ORM

like image 173
James A Mohler Avatar answered Feb 09 '26 01:02

James A Mohler