为什么NHibernate AutoFlush检查如此昂贵? [英] Why is NHibernate AutoFlush check so expensive?

查看:101
本文介绍了为什么NHibernate AutoFlush检查如此昂贵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我们发现默认的NHibernate(v2.0& 2.1)FlushMode = Auto非常昂贵.查阅NHibernate资料表明,用于确定需要清除哪些内容的算法依赖于遍历会话中所有实体的蛮力,并且在事务中运行的每个查询都会发生这种情况.

In practice we are finding the default NHibernate (v2.0 & 2.1) FlushMode=Auto to be extremely expensive. Reviewing the NHibernate source suggests that the algorithms for determining what needs to be flushed rely on brute-force of looping through all entities in session, and this occurs for every query run in a transaction.

在某些生产场景中,其中包含许多项目的更新,多次查询,与FlushMode = Commit相比,使用FlushMode = Auto的过程要长100倍.

In some production scenario with updates on many items, with multiple queries we have seen the process 100 times longer with FlushMode=Auto compared to FlushMode=Commit.

在执行涉及多个更新,多个查询等的复杂"会话逻辑时,有关使用FlushMode的任何想法/建议/最佳实践.

Any thoughts/advice/best practices for usage of FlushMode when performing 'complex' session logic involving multiple updates, multiple queries etc.

关于优化nHibernate中的AutoFlush算法的任何想法吗?

Any ideas on optimizing the AutoFlush algorithms in nHibernate?

推荐答案

此缓慢是一个已知问题,在NH中以

This slowness is a known issue and is tracked in NH as NH-1365/GitHib Issue 857

NH中有三种冲洗模式:

There are three flush modes in NH:

这篇关于为什么NHibernate AutoFlush检查如此昂贵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆