在Web应用程序中大量使用NHibernate Futures

编程入门 行业动态 更新时间:2024-10-14 06:16:48
在Web应用程序中大量使用NHibernate Futures - 好还是坏?(Heavy use of NHibernate Futures in Web app - Good or bad?)

我在NHibernate上阅读Ayende关于期货的帖子并开始使用它。 最初仅针对隔离场景 - 返回分页结果的查询(对单个数据库中的查询和计数项目)。 但是我想为什么不为每一个查询使用期货。 在我的大多数操作方法中,我需要进行多次查询,平均每页5次(获取用户个人资料,页脚,类别,组信息等)。

显而易见的好处是总体上这个查询总结应该花费更短的时间来运行。 但是这样的Web应用程序设计有什么缺点吗? 让我好奇的领域是:

NHibernate中的缓存 - 这种设计会阻止以任何方式使用NHibernate的缓存功能吗? 也许这样的单一包查询会锁定数据库表并使其他并行操作等待? 我使用Read Committed隔离级别。

任何其他? 你对期货的经历是什么? 您是否会建议以这种方式使用它,以及每个可能的项目?

I read Ayende post about Futures in NHibernate and started using it. At first only for isolated scenario - queries that return paged results (to both query and count items in single trip to database). But than I thought why not to use futures for every single query. In most of my action methods I need to make multiple queries, on average 5 per page (to get user profile, footer, categories, group information etc).

Obvious benefit is that overall this queries summed up should take shorter to run. But are there any drawbacks for such design of web application? Areas that make me curious are:

Caching in NHibernate - will this design prevent in any way of using caching features of NHibernate? Maybe such single pack of queries will lock database tables and make other parallel actions wait? I use Read Committed isolation level.

Any other? What are your experiences with futures? Would you recommend using it in such a way, to every possible item?

最满意答案

您的疑虑将不适用。 缓存不会被破坏,锁定表只是批量读取语句非常罕见。

期货摇滚,我希望我使用的每一个ORM都有它们。

Your concerns won't apply. Caching won't be broken and its pretty rare to lock tables just batching up read statements.

Futures rock and I wish every ORM I use had them.

更多推荐

本文发布于:2023-08-03 22:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1398909.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   Web   Futures   NHibernate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!