我已经使用enyim为我们的网站实现了一个缓存接口和memchanged提供程序。在我们进行负载测试之前,它在测试中的效果很好,在负载测试中,w3wp.exe的CPU占用率接近100%。我们有一个配置属性来将缓存提供程序切换回dotnet的API,CPU将回到5-7%。有没有人有过类似的经历?
发布于 2011-05-11 20:38:28
还要确保检查序列化和反序列化代码,以获得适当的对象或流处理。
我也有同样的w3p.exe问题,有99%的症状,我以为这是Enyim/Membase驱动程序的错误,但它不是,这是我们的,因为我们在反序列化我们的JSON helper类中的每个MemoryStream对象后,忘记了Dispose():
public static T DeserializeToObject<T>(this string json)
{
byte[] byteArray = Encoding.ASCII.GetBytes( json );
MemoryStream stream = new MemoryStream( byteArray );
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T));
T returnObject = (T)serializer.ReadObject(stream);
stream.Close();
stream.Dispose(); // we forgot this line!
return returnObject;
}
https://stackoverflow.com/questions/1132657
复制相似问题