使用 NProf 进行分析运行期间清除 NHibernate 缓存

发布于 2024-09-17 19:37:21 字数 409 浏览 0 评论 0原文

我们正在尝试使用 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 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文