项目消息缓存的问题 [英] problem with items disappearing for cache

查看:63
本文介绍了项目消息缓存的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在尝试在asp.net缓存中保存一些项目,但是它们被从缓存中移除

WAY在他们应该之前(至少我理解

文档)。


我使用


this.Context.Cache.Insert(key,userInfo,null,

System.Web.Caching.Cache.NoAbsoluteExpiration,TimeSpan.FromMinutes(10),

System.Web.Caching.CacheItemPriority.Default,

新的System.Web.Caching.CacheItemRemovedCallback(itemRe移动));


但是项目是

之后从缓存中移除(原因是未充分利用)1分钟。


这里发生了什么?


谢谢,

Nadav

解决方案

系统是否处于内存压力下?

工作流程是否被回收?


有性能计数器可帮助识别这两个问题上面的ems,

除了跟踪

Cache API行为的特定性能计数器。


Karl
-
http://www.openmymind.net/
http://www.fuelindustries.com/

" Nadav Popplewell" < Ba ******** @ newsgroup.nospamwrote in message

news:15 ********************** ************ @ microsof t.com ...


大家好,


我正在尝试在asp.net缓存中保存一些项目,但是它们应该从缓存WAY中删除

之前(至少我理解
$ b) $ b

文档)。


我使用


this.Context将对象添加到缓存中。 Cache.Insert(key,userInfo,null,

System.Web.Caching.Cache.NoAbsoluteExpiration,TimeSpan.FromMinutes(10),

System.Web.Caching.CacheItemPriority .Default,

新的System.Web.Caching.CacheItemRemovedCallback(itemRe移动));


但是项目从缓存中删除(原因是未充分利用)之后

就像1分钟一样。


这里发生了什么?


谢谢,
Nadav


感谢卡尔的意见。


你好Nadav,


假设你没有''为您的应用程序使用webfarm或webgarden(仅在单个服务器和单个工作进程上托管
)。由于Karl提到了
,您可以先检查服务器计算机上的内存压力。

有些情况下ASP.NET Web应用程序将重新启动或

工作进程将回收,这肯定会导致ASP.NET

applciation的缓存数据丢失。


对于ASP .NET工作进程回收,您可以尝试查找服务器的

事件日志,以查看是否存在工作进程回收条目。对于

ASP.NET应用程序重启,可以使用Application_End,

application_Start事件进行日志记录。


#Logging ASP .NET应用程序关闭事件
http ://weblogs.asp.net/scottgu/archi...14/433194.aspx


此外,对于ASP.NET应用程序/进程健康监控,您可以还有

使用windows性能计数器。这里有一些特定的类别

和柜台


**流程

**线程

* *处理器

**内存

** .NET CLR数据

**。NET CLR例外

* * .NET CLR Jit

**。NET CLR LocksAndThreads

**。NET CLR内存

** ASP.NET v2.0.50727

** ASP.NET应用程序v2.0.50727


希望这也可以帮助您解决问题。


真诚,


Steven Cheng


Microsoft MSDN在线支持主管


====== ============================================


通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。


注意:MSDN托管新闻组支持服务是针对非紧急问题

如果社区或微软支持人员在1个工作日内做出初步回复是可以接受的。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx


==================================== ==============


此帖子按原样提供。没有保证,也没有授予任何权利。


嗨史蒂文,


是的,机器在内存中压力

(我假设页面文件使用1.5GB,1GB内存被认为是内存

压力)。

将回收工人进程会干扰调试吗?

我的意思是,在我调试的时候,web服务器可以回收工作进程吗?没有我注意到应用程序吗?


(顺便说一句,我使用VS2005的内部网络服务器,而不是IIS)


如果问题是内存压力,对我来说有什么办法吗?为了防止这种回收发生了吗?

缓存中的一些项目我可以根据需要重新创建,所以这不是问题。

但是在在某些情况下,在我正在从缓存中读取项目的地方,我不能再次b / b
重新创建该项目,所以我必须确保该对象将保留在缓存中
一定数量的
时间。


我正在尝试实现一个DynamicImage控件,其中

控件的事件处理程序创建图像并将其存储在缓存中, HttpHandler

稍后从缓存中读取它并返回它。 HttpHandler不能重新创建

图像!


谢谢,

Nadav


Hi Everybody,

I''m trying to save some items in the asp.net cache, but they are removed
from the cache WAY before they are supposed to (at least as I understand the
documentation).

I add the object to the cache using

this.Context.Cache.Insert(key, userInfo, null,
System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10),
System.Web.Caching.CacheItemPriority.Default,
new System.Web.Caching.CacheItemRemovedCallback(itemRe moved));

but the Item is removed from the cache (with reason of underused) after
something like 1 minute.

What is going on here?

Thanks,
Nadav

解决方案

Is the system under memory pressure?

Is the worker process being recycled?

There are performance counters to help identify both problems above, in
addition to specific performance counters that track the behaviour of the
Cache API.

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Nadav Popplewell" <Ba********@newsgroup.nospamwrote in message
news:15**********************************@microsof t.com...

Hi Everybody,

I''m trying to save some items in the asp.net cache, but they are removed
from the cache WAY before they are supposed to (at least as I understand
the
documentation).

I add the object to the cache using

this.Context.Cache.Insert(key, userInfo, null,
System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10),
System.Web.Caching.CacheItemPriority.Default,
new System.Web.Caching.CacheItemRemovedCallback(itemRe moved));

but the Item is removed from the cache (with reason of underused) after
something like 1 minute.

What is going on here?

Thanks,
Nadav


Thanks for Karl''s input.

Hello Nadav,

Assume that you haven''t used webfarm or webgarden for your application(only
hosted on a single server and single worker process). As Karl has
mentioned, you can first check the memory pressure on the server machine.
There are some cases that the ASP.NET web application will restart or the
worker process will recycle, this will surely cause the ASP.NET
applciation''s cache data be lost.

For ASP.NET worker process recycle, you can try looking up the server''s
event log to see whether there is worker process recycle entries there. For
ASP.NET application restart, you can use the Application_End,
application_Start event to do logging.

#Logging ASP.NET Application Shutdown Events
http://weblogs.asp.net/scottgu/archi...14/433194.aspx

Also, for ASP.NET application/process healthy monitoring, you can also
utilize the windows performance counters. Here are some specific categories
and counters

**Process
**Thread
**Processor
**Memory
** .NET CLR Data
**.NET CLR Exceptions
** .NET CLR Jit
**.NET CLR LocksAndThreads
**.NET CLR Memory
** ASP.NET v2.0.50727
** ASP.NET Applications v2.0.50727

Hope this also helps some for your troubleshooting.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Hi Steven,

Yes, the machine is under memory pressure
(I assume that Page File usage of 1.5GB with 1GB of ram is considered memory
pressure).
Will recycling of the worker process interfere with debugging?
I mean, can the web server recycle the worker process while I''m debugging
the application without me noticing?

(by the way I''m using the internal web server of VS2005, not IIS)

If the problem IS memory pressure, is there some way for me to prevent this
recycling happening?
Some items on the cache I can recreate if needed, so this is not a problem.
But in some cases, at the place I''m reading the item from the cache, I can''t
recreate the item, so I MUST insure that the object will remain in the cache
for a certain amount of time.

I''m trying to implement a DynamicImage control where an event handler of the
control creates the image and stores it in the cache, and the HttpHandler
later reads it from the cache and returns it. The HttpHandler CAN''T recreate
the image!

Thanks,
Nadav


这篇关于项目消息缓存的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆