我正在使用以下方法将相当大的数据表缓存到应用程序缓存中:
HttpContext.Current.Cache.Insert(GlobalVars.Current.applicationID + "_" + cacheName, itemToCache, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(240));
如您所见,它应该在缓存中保留 4 小时,但是我们看到了奇怪的结果:
在 CPU 和 RAM 使用率较低的站点(例如 0-150 个用户)上,我们不会收到任何错误。
在 CPU 使用率高且 RAM 使用率低的站点上(CPU ~90%,300 - 600 个用户),我们每 20-60 分钟就会收到以下错误:
Cannot find column EditorOrder.
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IndexOutOfRangeException: Cannot find column EditorOrder.
at System.Data.DataTable.ParseSortString(String sortString)
at System.Data.DataView.set_Sort(String value)
at delima_v1._01.templates.results.editors_picks.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
EditorOrder 是从 SQL 获取结果后手动添加到数据表的列。所以我不确定该列是否以某种方式被删除或整个缓存正在丢失,该错误似乎表明它正在丢失该列。正如我所说,它似乎只是在高负载下,因此不确定 IIS/Windows 是否有任何影响......
站点在 64 位 AppPool 中运行 ASP.NET 4.0
提前谢谢了,
戴夫