使用 NProf 进行分析运行期间清除 NHibernate 缓存
我们正在尝试使用 NHibernate 应用程序来分析我们的 NHibernate 应用程序。我们有一系列的单元测试来执行各种调用。但是,如果我们多次运行单元测试,我们会在 NProf 中得到不同的结果:
- 会话 1 [1]
- 会话 2 [32]
- 会话 3 [32]
- 会话 4 [2]
- 会话 5 [2]
我尝试过调用 session. Clear() 在单元测试结束时,并尝试重建解决方案。但基本上我们想要调整和调优查询,如果 NHibernate 在运行之间进行缓存,则无法做到这一点。当然其他人以前也遇到过这个问题,我们只是太密集了,但我很感激你能提供的任何帮助。
更新 好的,如果这是预期的行为,那么如何测试查询优化呢?
We are attepting to profile our NHibernate application using NHProf. We have a series of unit tests which exercise various calls. However, if we run the unit test multiple times, we get differing results in NHProf:
- Session 1 [1]
- Session 2 [32]
- Session 3 [32]
- Session 4 [2]
- Session 5 [2]
I've tried calling session.Clear() at the end of the unit test, and tried rebuilding the solution. But basically we're wanting to tweak and tune the queries, and can't do that if NHibernate is caching between runs. Surely others have run into this before and we're just being dense, but I'd appreciate any help you can provide.
Update Ok, if that's the expected behavior, how does one go about testing optimizations to queries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是完全清除缓存的方法:http://sessionfactory。 blogspot.com/2010/08/clearing-second-level-cache.html
Here's how to clear the cache completely: http://sessionfactory.blogspot.com/2010/08/clearing-second-level-cache.html