user jambrez: Limiting amount of RAM using by shared cache

Topics: Developer Forum, User Forum
Coordinator
Mar 13, 2009 at 7:57 PM
Edited Mar 13, 2009 at 7:58 PM
jambrez posted the follwoing:

Is it possible to limit amount of RAM using by shared cache? I would like to use (for exaplme) 100MB for this - not the whole size of available RAM. Firstly I thought that the parameter called "CacheAmountOfObjects" is responsible for that, but I noticed that much more RAM (than 100MB) is using. Could You help me, please?

Coordinator
Mar 13, 2009 at 8:20 PM

limitation of used ram is based on server configuration, which is a value which is not fix. it's a combination of various settings within server configruation. 

e.g: 
CacheAmountOfObject="100"                     -> max. amount of server ram. in some cases this can take some time until Garbage Collection will really free up space in ram. Shared Cache does not use GC.Collect();
CacheAmountFillFactorInPercentage="90"   -> if your cache reach 90MB it start to purge / clean your data until you get back to 90MB
ServiceCacheCleanup="LRU"                      -> Shared Cache contains various options to purge / cleanup items which added to cache. Based on
                                                          customers need this can be easly configured on server configuration section. for more information checkout 
                                                          the following link:
http://www.sharedcache.com/cms/default.aspx?pg=e35d3c46-a380-44b3-8429-875481aa1909

if you like to monitor specific allocated ram of shared cache I suggest to use Process Explorer by SysInternals: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx it allow to monitor specific applications. Once you run Process Explorer choose the .Net tab and below .NET Performance Objects select .NET CLR Memory. Once you have selected this option look at GEN 0, GEN 1, GEN 2 collections. 

  • # Gen 0 Collections: This counter displays the number of times the generation 0 objects (youngest; most recently allocated) are garbage collected (Gen 0 GC) since the start of the application. Gen 0 GC occurs when the available memory in generation 0 is not sufficient to satisfy an allocation request. This counter is incremented at the end of a Gen 0 GC. Higher generation GCs include all lower generation GCs. This counter is explicitly incremented when a higher generation (Gen 1 or Gen 2) GC occurs. _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
  • # Gen 1 Collections: This counter displays the number of times the generation 1 objects are garbage collected since the start of the application. The counter is incremented at the end of a Gen 1 GC. Higher generation GCs include all lower generation GCs. This counter is explicitly incremented when a higher generation (Gen 2) GC occurs. _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
  • # Gen 2 Collections: This counter displays the number of times the generation 2 objects (older) are garbage collected since the start of the application. The counter is incremented at the end of a Gen 2 GC (also called full GC). _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.

    hope this helps.

    regards,
    roni

  • Mar 17, 2009 at 11:36 AM
    I still have some problems with testing SharedCache. The size of the cache seems to bo not proper. When I test my application, the service "MergeSystem.Indexus.WinService" uses ~55MB(private bytes), ~25MB(Working Set). It's nearly constant value, when application is running no matter I made some changes in configuration file (I am using LoadRunner program to simulate many users). But if I use application MergeSystem.Indexus.WinServiceTestClient.exe instead (to test), much more RAM is using (hundreds of MB, but configuration file is the same!). Isn't it strange? This is my server configuration:

    serverSetting
    ServiceCacheIpAddress="127.0.0.1"
    ServiceCacheIpPort
    ="48888"
    SharedCacheVersionNumber
    ="2.0.4.273"
    LoggingEnable="1"
    ServiceFamilyMode
    ="0"
    CacheAmountOfObjects
    ="150"
    CacheAmountFillFactorInPercentage
    ="90"
    ServiceCacheCleanup="LRU"
    ServiceCacheCleanupThreadJob
    ="3600000"
    TcpServerMaxThreadToSet
    ="-1"
    TcpServerMinThreadToSet
    ="-1" />
     
    I would bo grateful for every advice, thanks:)
    Coordinator
    Mar 17, 2009 at 7:01 PM
    hi, i have seen you're using the service "MergeSystem.Indexus.WinService" and version 2.0.4.273. a question in general, are you able to upgrade your version to the latest sources?  regards, roni
    Mar 19, 2009 at 9:40 AM
    I have upgraded my version to the latest source, but unfortunately problem is the same. Even if I try to use only application SharedCache.WinServiceTestClient.exe the size of cache is not as it is set in config file. I set:
    CacheAmountOfObjects="150"
    CacheAmountFillFactorInPercentage
    ="90",
    but nearly whole RAM is using.
    Coordinator
    Mar 19, 2009 at 12:50 PM
    This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.