NHibernate Profiler - 缓存实体
我刚刚实现了 SysCache2 并为解决方案中的某些实体激活了缓存。 一切工作正常,但我确实有一个问题:
有时当我浏览特定页面时,NHibernate Profiler 显示正在获取大量缓存实体。几百个缓存实体应该是一个相当大的数量,但有时会达到 3000-5000 个。见下图。
在这种情况下,是否真的从缓存中获取了 5002 个实体,或者 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,它确实在获取所有条目。另外,您的屏幕截图已被裁剪,但我假设您收到来自 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.