Skip to main content
Participating Frequently
December 20, 2010
Question

Cannot allocate memory for multi server instances

  • December 20, 2010
  • 6 replies
  • 3496 views

This is my first foray into CF 9 multi server environment and I'm having a little trouble.  I have 16GB of memory in the machine but if I set the JVM size (via the JMC) to more than 1GB the server(s) will not start and I get an error about "unallowed heap size".  I looked at the article that tells you how to set up different values for each instance but I just looking to allocate as much as I can evenly to each instance.  How/where do I set the JVM memory?  Also, where the heck is the JMC documented?  I found it only by hunting around the forum until I found a reference to its existence.

Thanks!

    This topic has been closed for replies.

    6 replies

    JCoxAuthor
    Participating Frequently
    December 21, 2010

    Charlie,

    Here is what I am seeing on my three instances (the cfusion one plus two I created)

    From the windows Task Manager:

    cfusion - 547K

    Cfusion2- 487K

    cfusion3 - 473K

    From CF Administrator Server Monitor the JVM Memory (used/max):

    cfusion - 41 / 421

    cfusion2 - 337 / 477

    cfusion3 - 285 / 362

    Do these look 'normal' for a machine that is sitting idle;  that is, I'm not calling any .cfm files, it's just sitting there with no load. 

    Thanks,

    Jim

    Charlie Arehart
    Community Expert
    Community Expert
    December 21, 2010

    Well, that's yet a different question. So first, the task manager and server monitor are reporting different things. The latter is the heap, and that's just part of what's reported in the former (which also includes other JVM memory spaces, as well as OS memory usage like DLLs, etc.)

    Second, as for the CF Server monitor reporting the used amounts, when you say they're "idle", well, keep in mind 2 things. Just because it's "idle" doesn’t mean that memory used previously is not still in use. You server and the traffic that has visited it (real people or bots, etc.) could have created sessions, cached queries, and more. Once in memory, those will remain as long as their respective timeouts have been set.

    But more important, just because the memory is marked as "used" in the server monitor doesn't really mean it's "still in use". It could be that it was used, and has been released to be garbage collected (such as a query in a request that is now finished), but the JVM simply hasn’t garbage-collected it yet. You can confirm if that's the case by clicking the "run gc" button in the top left of the Server Monitor's Memory Usage Summary page. If the memory drops, then that's all it was.

    This whole subject of JVM memory in CF is the source of a lot of confusion, even among people with years of experience. There's a lot of myth, misinformation, and misunderstanding regarding it. I'm trying to help how I can, by having started a series of blog entries to address this very topic.

    CF911: Lies, damned lies, and when memory problems not be at all what they seem, Part 1

    http://www.carehart.org/blog/client/index.cfm/2010/11/3/when_memory_problems_arent_what_they_seem_part_1

    Hope that helps.

    /charlie arehart

    charlie@carehart.org

    Providing CF and CFBuilder troubleshooting services

    at http://www.carehart.org/consulting

    /Charlie (troubleshooter, carehart. org)
    JCoxAuthor
    Participating Frequently
    December 21, 2010

    Charlie,

    Thanks, and I will read your blog.

    When I mean idle, I mean nothing is hitting any of the sites as it is isolated on our private development network and I'm the only one working on the machine.  I thought the same thing you did about the GC and I manually ran it for each of the instances.  So, the numbers you see are AFTER garbage collection.  I just have no idea if these look normal or not.

    Jim

    JCoxAuthor
    Participating Frequently
    December 21, 2010

    Thank you all for your help.  I was able to create separate jvm.config files for each of my instances by using the second article that Charlie listed in his post.  However, despite setting those config files at 1024meg each, none of them are more than 500K in size and the internal overhead for each instance seems a bit high.  There is 16 Gig in the machine and yes, since it's 32 bit, I realize I only have 4 Gig addressable but with all three instances running there is still 2 gig of free physical memory.   Am I running into a windows physical memory 'reserve' of some kind.  If so, can I alter it?

    Thanks.

    Charlie Arehart
    Community Expert
    Community Expert
    December 21, 2010

    Glad to have helped, Jim. Now, for this message, by what measure are you determining that "despite setting those config files at 1024meg each, none of them are more than 500K in size"?

    Are you viewing the CF Server Monitor's "memory usage summary"? If so, you may be being confused by its reference to "total" memory. If you have not set both min AND max memory (in the jvm.config), then the JVM will only allocate memory as needed--up to the max. What you're likely seeing in the memory usage summary is instead the currently "allocated" amount, despite its calling it "max memory" (in CF9, or "total memory" in CF8).

    Also, what do you mean, " the internal overhead for each instance seems a bit high"?

    /charlie arehart

    charlie@carehart.org

    Providing CF and CFBuilder troubleshooting services

    at http://www.carehart.org/consulting

    /Charlie (troubleshooter, carehart. org)
    Charlie Arehart
    Community Expert
    Community Expert
    December 20, 2010

    Jim, besides the useful answers that the others have said, I want to address two other issues you may want to consider.

    First, I want to pick up on your reference to the "JMC". By that I assume you mean the JRun Management Console. I'll say again, like I did to your questions earlier today about using the WAR file deployment, that you seem to be going about things in a curious way. The JMC is not something that most people should bother with.

    I realize it appears in the Start menu (assuming you deployed on Windows) along with the CF Admin, but really, you ought not need to use it. It's really a vestige of the days before CF 7, when there was not the Enterprise Manager in the cfusion instance in a Multiserver deployment. Though some people may point out esoteric features that it adds, really, for 99% of people I interact with (here and in my role of providing CF troubleshooting support) just really don't need anything in the JMC.

    In fact, if you don't bother to use that JMC, then you can also turn off the service associated with it: "Macromedia JRun Admin Server". It only exists to that the JMC (a JSP/servlet app) can run. If you don't use the JMC, you can stop that service (it has no affect at all on the CF Admin), and you'll save the memory and CPU that would have been allocated to it.

    Second, you also mention an interest in allocating your memory across multiple instances. Beware, then, that when you DO make the change to the jvm.config as others have mentioned (which in the Multiserver mode is in fact the only way to set the memory for an instance), that jvm.config is by default shared among ALL your JRun instances (the cfusion instance, any you create, and also that JRun Admin instance).

    If one did NOT want to have the memory setting shared by them all, then one must instead create a separate jvm.config for any instances that you want to have their own different settings. If one starts CF from the command line, it's easy to then point to that new jvm.config for a given instance. If one starts CF as a windows service, it's quite a bit harder, because the name of the jvm.config is stored in the properties of the instance (in a way not configurable in the Windows Services panel). Instead, one must use a command-line jrunsvc command (in \bin) to remove and recreate the service's properties. There are various blog entries that have elaborated on this:

    http://blog.alagad.com/2007/06/15/cf7-cf8-jrun-and-the-jvm/

    http://www.n8williams.com/devblog/coldfusion/multiple-coldfusion-instances-with-separate-jvm-configs-as-windows-services

    http://www.coldfusionmuse.com/index.cfm/2006/4/17/multiserver

    Hope that's helpful.

    /charlie arehart

    charlie@carehart.org

    Providing CF and CFBuilder troubleshooting services

    at http://www.carehart.org/consulting

    /Charlie (troubleshooter, carehart. org)
    ecobb
    Inspiring
    December 21, 2010

    carehart wrote:

    It's really a vestige of the days before CF 7, when there was not the Enterprise Manager in the cfusion instance in a Multiserver deployment.

    Ha!  I had actually completely forgotten about the JRun Management Console.

    Ah, the memories....

    -- 
    Thanks,

    Eric Cobb
    ECAR Technologies, LLC
    http://www.ecartech.com
    http://www.cfgears.com
    Legend
    December 21, 2010

    Think over the years I have only had to do so once or twice. For whatever reason the Windows admin guy would not give me the CF filesystem access on the muti server install. Anyways I needed to add some regional timezone things to JVM. So I used JMC to add those then stop and start the instance - I could not get services.msc and was IP blocked from CF enterprise manager.

    Legend
    December 20, 2010

    JMC - I do not use it very much myself and maybe is not used very much in CF community. I guess others will respond if otherwise.

    http://localhost:8000/ localhost domain may not be correct in your case.

    U=admin P= whatever you configured it to be when installing CF

    From left menu select instance name > settings

    Under Java VM Settings

    Max Heap Size (default 512) - set to value that suits

    VM Arguments

    add initial size and minimum PermGen settings here eg:

    -server -Xms512m -Dsun.io.useCanonCaches=false -XX:PermSize=152m -XX:MaxPermSize=192m -XX:+UseParallelGC etc

    I still think it is a good idea to backup your JVM.CONFIG before making changes in JMC.

    HTH, Carl.

    Legend
    December 20, 2010

    Hello,

    The memory can be configured via editing Jrun4\bin\jvm.config, this section:

    # Arguments to VM
    java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC etc

    To set more to the HEAP make Xmx bigger eg Xmx1024m. It can be a good idea to set an initial heap size -Xms512m the value depends some say to make it the same as the maximum. To configure a minimum size to the non heap Permanent Generation add -XX:PermSize=152m again value might need adjusting. I should add always backup you JVM.CONFIG before making changes.

    Note on 32 bit Windows systems the maximum heap size will range from 1.4Gb. Java reference:

    http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#gc_heap_32bit

    HTH, Carl.

    ilssac
    Inspiring
    December 20, 2010

    You installed the 64bit ColdFusion 9 version correct?

    If you didn't and have the 32bit version, then a tiny bit over 1GB is all that it can handle per instance.