开发者

NHibernate Profiler - cached entities

I've just implemented SysCache2 and activated caching for some of the entities in my solution. Everything is working fine, but i do have one question:

Sometimes when im browsing a specific page, NHibernate Profiler shows a very high number of cached entities being fetched. A couple of hundred cached entities should be a fair amount that would be used, but sometimes it counts up to 3000-5000. See image below.

In this case, are 5002 entities really being fetched from the cache, or is there a misprint in NHibernate Profiler?

Loading-wise, everything seems ok. The page request has fi开发者_JAVA技巧nished, but the profiler keeps counting up more and more cached entities.

Anyone experienced anything similiar or does this really occur?

NHibernate Profiler - cached entities


Well, it's really fetching all the entries. Also, you're screenshot is cropped, but I'm assuming that you're receiving an alert from NHProf stating that there are too many cache calls.

NH has two different types of cache: the query cache and entity cache. The query cache only stores the identity of the items which resulted from the query (i.e, no data). Then NH has to fetch the items individually from the entity cache by ID.

More info at: http://ayende.com/blog/3112/nhibernate-and-the-second-level-cache-tips

Be careful that this may impact performance at the web-server. I had the exact same situation as you, and had better results disabling the second-level cache for these entities.

Also, it keeps showing new entries even after the page has loaded due to some latency between the appender and NHProf. The appender sends all the log to NHProf, and it takes some time for it to draw all the info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜