Copy link to clipboard
Copied
I have a server problem in which the heap gets to the maximum, and doesn't free space. This obviously makes the app run extremely slow and some times crash. I know the best solution is to look in code for memory leaks and optimize. I've done everything I can think of and the heap still continues to climb. Most of the apps hosted on the server contain persistent variables and store a lot in the APPLICATION and SESSION scope. I need some magic JVM argument beans that can make the garbage collection go into overdrive to keep the heap small. I dont care about slowing the overall page serving down, it is better than it breaking until I can figure out what is wrong. I've also increased my heap to about 1.2 gb (the most it will allow). Any suggestions would be helpful.
Copy link to clipboard
Copied
GC will automatically run as often as necessary, but if there's no actual memory to free - IE: it's all legitimately still allocated - then this won't help you.
You're probably better off trying to work out what's taking up all the memory.
We used to store user objects in session, but their memory footprint is unexpectedly large, so we abandoned that approach.
How many concurrent sessions are you running at any given time? What sort of thing are you storing in session and application?
Can you cache stuff to disk rather than memory?
--
Adam
Copy link to clipboard
Copied
Firstly, it uses fusebox (haven't found any know memory leak issues there). We have about 20 sites with e-commerce and content management per server. Each "Admin" stores a hundred or so application variables for configuration. Most of them are simple strings or bits. The "Sessions" dont contain that much for the admin, it is more heavily database driven. I just recently read that for SQL Server, using the "jTDS JDBC Driver" may help with some memory leaks, so I think that is my next move.
I guess now that I write it is seems like a lot of application variables, but considering they are all of a simple data type, I can't see them taking up much space at all.
Copy link to clipboard
Copied
Can you tell us more about your server environment? It might be useful to know:
The version of ColdFusion you are using
The operating system
The web server
The JVM version
Copy link to clipboard
Copied
CF 8.0.1 /w Cummulitive Hotfix Pack
Standard included JVM (1.6.0_04)
IIS 6 and 7 depending on the server
Win 2003 and 2008 depending on server
One of the worst offenders is running 64bit windows, I think that may have more to do with the particular load of the server rather than its 64bit-ness but I'm dont know for sure. IIS runs in 32-bit mode because CF8 standard does not support 64 bit.
Below is JVM.config
#
# VM configuration
#
# Where to find JVM, if {java.home}/jre exists then that JVM is used
# if not then it must be the path to the JRE itself
java.home=C:/ColdFusion8/runtime/jre
#
# If no java.home is specified a VM is located by looking in these places in this
# order:
#
# 1) bin directory for java.dll (windows) or lib/<ARCH>/libjava.so (unix)
# 2) ../jre
# 3) registry (windows only)
# 4) JAVA_HOME env var plus jre (ie $JAVA_HOME/jre)
#
# Arguments to VM
java.args=-server -Xmx1175m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=350m -XX:+UseParallelGC -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
#
# 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,{application.home}/../jintegra/bin,{application.home}/../jintegra/bin/international
system.path.first=false
#
# set the current working directory - useful for Windows to control
# the default search path used when loading DLLs since it comes
# before system directory, windows directory and PATH
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
Copy link to clipboard
Copied
You might look into using the ColdFusion Server Monitor to troubleshoot your problems. However, I'm not sure if this feature is included in CF 8 standard.
http://livedocs.adobe.com/coldfusion/8/htmldocs/servermonitor_01.html#1065364
Copy link to clipboard
Copied
You can try updating your JVM to JDK 1.6.0_14, the one that ships with CF9. I've done that for our CF8 production without any problems and can see quite drastic improvements, think there must have been quite some improvements in the garbage collection.
Copy link to clipboard
Copied
Well... I found an infinite loop condition in the code Seems like now when they\ heap gets to almost max it doesn't slow down. I suppose its properly releasing memory now.
Copy link to clipboard
Copied
That'd probably do it 😉
--
Adam