I need help clarifying memory usage on a CentOS server running Coldfusion/Apache.
I've got a script that reads a file into memory and process it line by line, inserts into DB and deletes the file. Not the best process, working on it, but it'll have to do for now.
When the file is read it takes up loads of memory, it was causing the server to use the swap file and it was really unresponsive - total RAM usage in TOP was 3.9/3.9 GB and swap was 1.5/1.9
I had to reboot it, total used RAM dropped to about 2GB, I ran the script and it went back up to 3GB. It's slowly increased over the last few hours to 3.3GB - I've still got some space and the sites are all responsive but memory isn't being freed.
Also since rebooting, FusionReactor shows my Max and Allocated Heap as 3.93GB, and Used ranging from 0.3GB to 1GB - which is inconsistent with what TOP says, which is CF9 on 58% of 3.9, which is around 2.25GB
The script imports data overnight, so I'm guessing when it runs later, it'll spill into the swap and slow the site down overnight (low traffic overnight but still needs fixing - I'll have to disable for now)
So the 2 things I don't understand:
- why isn't the RAM dropping back from 3 -> 2 when the file has been read, and the script has finished (missing a
fileClose
- too many CFCs?) - why does my FusionReactor Memory Used Heap show a max of 1GB, when TOP shows 58% of 3.9GB (2.25GB) for CF9
UPDATE - jvm.config, less most of it's comments
# Where to find JVM
java.home=/opt/coldfusion9/runtime/jre/
# Arguments to VM
java.args=-server -Djava.awt.headless=true -Xms4096m -Xmx4096m
-Dsun.io.useCanonCaches=false -XX:ParallelGCThreads=2 -XX:PermSize=64m
-XX:+UseConcMarkSweepGC -XX:NewSize=1024m -XX:MaxNewSize=1024m -XX:SurvivorRatio=4
-XX:+UseParNewGC -XX:MaxPermSize=192m -Dcoldfusion.rootDir={application.home}/../
-Dcoldfusion.libPath={application.home}/../lib -Dcoldfusion.classPath=
{application.home}/../lib/updates,{application.home}/../lib,
{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/flex/jars,
{application.home}/../wwwroot/WEB-INF/cfform/jars -
javaagent:/opt/fusionreactor/instance/coldfusion.CF9Standalone.cc02/
fusionreactor.jar=name=coldfusion.CF9Standalone.cc02,address=8088
# commas will be converted to platform specific separator and the result will be passed
# as -Djava.ext.dirs= to the VM
java.ext.dirs={jre.home}/lib/ext
# where to find shared libraries
java.library.path={application.home}/../lib
system.path.first=false
# set the current working directory
java.user.dir={application.home}/../../lib
# JVM classpath
java.class.path={application.home}/servers/lib,{application.home}/../lib/
macromedia_drivers.jar,
{application.home}/lib/cfmx_mbean.jar,{application.home}/../lib/oosdk/classes,
{application.home}/../lib/oosdk/lib,{application.home}/lib