AppFabric的缓存内存非常密集 [英] AppFabric Cache memory very intensive
问题描述
问题(S):我是不是做错了什么?不正确的配置设置?低于正常显示内存使用由AppFabric的金额是多少?
The question(s): Am I doing something wrong? Incorrect config setting? Is the amount of memory usage by AppFabric shown below normal?
问题:我正在读从SQL数据库表中的数据导入的AppFabric高速缓存。这似乎是AppFabric中使用了大量的内存为一个相当小的对象,我无法理解为什么
The problem: I am reading the data from a SQL database table into AppFabric cache memory. It seems like AppFabric uses a large amount of memory for a fairly small object and I cant understand why(I have recently started using ApppFabric-so I am a noob with it)
说明:约60MB的SQL表中的AppFabric缓存一旦转换为约800MB。
Description: A SQL table of about 60MB converts to about 800MB once in AppFabric cache.
详细内容:
表我打算 SQL数据大小来加载:
应用面料空闲内存的使用情况:
服务器配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core" />
</configSections>
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="MobileCache" minSecondaries="0">
<policy>
<eviction type="None" />
<expiration defaultTTL="1" isExpirable="false" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="default" minSecondaries="0">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="1073911731" size="1000" leadHost="true" account="BGZA\accName"
cacheHostName="AppFabricCachingService" name="hostname.domain.co.za"
cachePort="22233" />
</hosts>
<advancedProperties>
<transportProperties connectionBufferSize="131072" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxOutputDelay="2" channelInitializationTimeout="60000"
receiveTimeout="600000"/>
<securityProperties>
<authorization>
<allow users="Rossp0033" />
</authorization>
</securityProperties>
</advancedProperties>
<deploymentSettings>
<deploymentMode value="RoutingClient" />
</deploymentSettings>
客户端配置:??
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="dataCacheClient"
type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core,Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<dataCacheClient>
<hosts>
<host
name="HostName.DomainName.co.za"
cachePort="22233"/>
</hosts>
<transportProperties connectionBufferSize="131072" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxOutputDelay="2" channelInitializationTimeout="60000"
receiveTimeout="600000"/>
</dataCacheClient>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
C#代码:
public static void ReadPortedNumbers()
{
MobileDataContext mdc = null;
List<PortedNumberCollection> col;
try
{
mdc = new MobileDataContext(strConnString);
col = (from RN in mdc.tblRoutedNumbers
select Convert(RN)).ToList();
var CacheFactory = new DataCacheFactory();
var myCache = CacheFactory.GetCache("MobileCache");
myCache.Put("PortedNumberCollection", col);
}
catch (Exception E)
{
throw new System.Exception(E.GetType().ToString() + " in BG.Mobile.DAL.ReadPortedNumbers, Message : " + E.Message, E);
}
finally
{
if (mdc != null) mdc.Dispose();
}
}
public static PortedNumberCollection Convert(tblRoutedNumber DataClass)
{
try
{
PortedNumberCollection BusinessClass = new PortedNumberCollection();
BusinessClass.PortedID = DataClass.PortedID;
BusinessClass.MSISDN = DataClass.MSISDN;
BusinessClass.RoutingLabel = DataClass.RoutingLabel;
BusinessClass.RouteAction = DataClass.RouteAction;
return BusinessClass;
}
catch (Exception E)
{
throw new System.Exception(E.GetType().ToString() + " in BG.Bus.Mobile.DALConvertor.Convert(tblRoutedNumber DataClass): " + E.Message);
}
}
[DataContract][Serializable]
public class PortedNumberCollection
{
[DataMember]
public Int64 PortedID;
[DataMember]
public string MSISDN;
[DataMember]
public string RoutingLabel;
[DataMember]
public string RouteAction;
}
AppFabric的内存使用情况,一旦数据被加载(放):
AppFabric memory usage once data is loaded(put):
推荐答案
我想回答我的问题了谁读这未来的用户。
I would like to answer my own question for any future users who read this.
不要使用AppFabric的,而看产品,如Redis的或Memcached的。他们以各种方式,我可以看得更清楚。
Do not use AppFabric rather look at products like Redis or MemCached. They are better in every way that I can see.
AppFabric中仍然有办法为它在我的生产系统太多问题。
AppFabric still has way too many problems for it to be in my production systems.
这篇关于AppFabric的缓存内存非常密集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!