NHibernate Profiler - 缓存实体

发布于 2024-11-08 03:42:59 字数 385 浏览 0 评论 0原文

我刚刚实现了 SysCache2 并为解决方案中的某些实体激活了缓存。 一切工作正常,但我确实有一个问题:

有时当我浏览特定页面时,NHibernate Profiler 显示正在获取大量缓存实体。几百个缓存实体应该是一个相当大的数量,但有时会达到 3000-5000 个。见下图。

在这种情况下,是否真的从缓存中获取了 5002 个实体,或者 NHibernate Profiler 中是否存在打印错误?

加载方面,一切似乎都很好。页面请求已完成,但探查器不断计数越来越多的缓存实体。

有谁经历过类似的事情或者这真的发生过吗?

NHibernate Profiler 缓存

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 finished, but the profiler keeps counting up more and more cached entities.

Anyone experienced anything similiar or does this really occur?

NHibernate Profiler Cache

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北座城市 2024-11-15 03:42:59

嗯,它确实在获取所有条目。另外,您的屏幕截图已被裁剪,但我假设您收到来自 NProf 的警报,指出缓存调用过多。

NH有两种不同类型的缓存:查询缓存和实体缓存。查询缓存仅存储查询结果的项目的标识(即,没有数据)。然后 NH 必须根据 ID 从实体缓存中单独获取项目。

更多信息请访问:http://ayende.com/blog /3112/nhibernate-and-the-second-level-cache-tips

请注意,这可能会影响 Web 服务器的性能。我遇到了与您完全相同的情况,并且禁用这些实体的二级缓存获得了更好的结果。

此外,由于附加程序和 NProf 之间存在一些延迟,即使在页面加载后,它也会继续显示新条目。 Appender 将所有日志发送给 NProf,并且需要一些时间来绘制所有信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文