Skip Navigation Links

Why use shared cache?

There is no more efficient way to increase the scalable performance of applications then the use caching to unload deeper layers.

Skip Navigation Links>> Shared Cache>> Shared Cache Config>> Configuration Server

indeXus.Net Shared Cache Server configuration

configSection Element  

Definition area for the additional config elements of replicatedSharedCache and nlog which is described below.
check msdn for more information about it (
http://msdn2.microsoft.com/en-us/library/aa903350.aspx )

<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
<section name="replicatedSharedCache" 
type="/>
MergeSystem.Indexus.WinServiceCommon.
Configuration.Server.IndexusServerProviderSection, 
MergeSystem.Indexus.WinServiceCommon"
</configSections>
 

replicatedSharedCache Element

The replicatedSharedCache element are defines your additional instance within your environment. Based on the provided / configured information indeXus.Net SharedCache will make a replication to the instances if they are available. Please notice that to enable replication you will have to enable the following configuration option within appSettings element: ServiceFamilyMode - "1". If this option is disabled the server does not make any replication.

check the following links for information about providers (
http://msdn2.microsoft.com/en-us/library/4ksaf9z5(VS.71).aspx or http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx )

 

<replicatedSharedCache defaultProvider="ServerSharedCacheProvider">
<serverSetting
    ServiceCacheIpAddress="127.0.0.1"
    ServiceCacheIpPort="48888"
    SharedCacheVersionNumber="2.0.0.261"
    LoggingEnable="1"
    ServiceFamilyMode="0"
    CacheAmountOfObjects="200"
    CacheAmountFillFactorInPercentage="90"
    ServiceCacheCleanup="LRU"
    ServiceCacheCleanupThreadJob="1"
    TcpServerMaxThreadToSet="-1"
    TcpServerMinThreadToSet="-1"
/>
<replicatedServers>
<!-- 
DO NOT DEFINE THE INSTANCE ITSELF !!! 
IT WILL BE AUTOMATICALLY REMOVED BY RUNTIME 
-->
<!--
    ONLY CONFIGURE THIS IF YOU SET FAMILY MODE TO 1
    <add key="SrvZh03" ipaddress="127.0.0.1" port="48888" />
    <add key="SrvZh02" ipaddress="192.168.212.37" port="48888" />
    <add key="SrvZh04" ipaddress="192.168.212.11" port="48888" />
    <add key="SrvZh05" ipaddress="192.168.212.12" port="48888" />
-->
</replicatedServers>
<providers>
<add
        name="ServerSharedCacheProvider"
        type=">
MergeSystem.Indexus.WinServiceCommon.Provider.
Server.IndexusServerSharedCacheProvider, 
MergeSystem.Indexus.WinServiceCommon"
</add>
</providers>
</replicatedSharedCache>

Server Settings

  • ServiceCacheIpAddress="127.0.0.1" - Location of Cache Service
  • ServiceCacheIpPort="48888"  - Location of Cache Service, the port number
  • SharedCacheVersionNumber="2.0.0.261" - Version Number, same like in assemblies
  • LoggingEnable="1" - Should information be logged it loggs mainly traffic data.
  • ServiceFamilyMode="0" - 1 - Enabled; 0 - Disabled; remember to configure the section of replicatedSharedCache.
  • CacheAmountOfObjects="200" - The maximum size of the objects in the Cache in MB. To make it unlimited, use value -1 which is the default
     in case of -1 you can receive OutOfMemoryException when the server is not able anymore to receive data.
  • CacheAmountFillFactorInPercentage="90" - If the cache received the fillfactor it will start to throw away unused items from the cache suggested is a value between: 85% - 95%. Default value is 90% and only used if you set CacheAmountOfObjects different then -1.
  • ServiceCacheCleanup="LRU" - Keys which can be used: "CACHEITEMPRIORITY", "LRU", "LFU", "TIMEBASED", "SIZE", "LLF", "HYBRID".
  • - CacheItemPriority: A new option will be created where objects which are added to the cache receives a priority attribute.
    - LRU: Least Recent Used: The objects with the oldest request's will be deleted
    - LFU: Least Frequently Used: Means the object's witch are used less will be deleted from the cache / if all objects are used in same frequency the objects will be used in a randomized order
    - Timebased: The objects with the smallest time left in the cache will be deleted, in case all objects are used with max time, they will be deleted randomized
    - SIZE: Delete always biggest objects until it received the size of FillFactor 
    - Lowest-Latency-First [LLF]: Delete smallest objects until configured FillFactor reached
    - Hybrid: Makes a combination between several parameters: TimeTaken, Amount of Requests, Size, Cache Life Time each parameter receives a number between 1 - n and those with the highest / lowest numbers will be deleted until configured FillFactory reached.
  • ServiceCacheCleanupThreadJob="1" - Expire thread interval, if the cache contains data which expires this background thread cleans the cache up [milliseconds].
       1  sec  -> 1000; 30 sec  -> 30000; 1 min  -> 60000; 1  hour -> 3600000; 1 day  -> 86400000;
       do not define a bigger value then this, the system will fail to read it - its an int 32 value. In case -1 is configured the Thread will be killed after startup.
  • TcpServerMaxThreadToSet="-1" - Value: -1 means it will be ignored - which in most cases is suggested, if nothing is configured it will take the default value which is provided by the system [e.g: min. 3 max. 25]
  • TcpServerMinThreadToSet="-1" - Value: -1 means it will be ignored - which in most cases is suggested, if nothing is configured it will take the default value which is provided by the system [e.g: min. 3 max. 25]

 replicatedServers

To work with replication there are 2 preconditions in app.config file of each server instance

  • The ServiceFamilyMode needs to be enabled => "1"
  • Configuration of all other server node need to be configured

<add key="SrvZh03" ipaddress="127.0.0.1" port="48888" />
<add key="SrvZh02" ipaddress="192.168.212.37" port="48888" />
<add key="SrvZh04" ipaddress="192.168.212.11" port="48888" />
<add key="SrvZh05" ipaddress="192.168.212.12" port="48888" />

NOTE: in above CONFIGURATION element no. 1 will be removed automatically upon startup because we don't gone replicate data to the same server node.