Nhibernate 2.1.0.4000比2.0.1.4000慢?任何NH默认设置都已更改?

时间:2009-12-04 12:59:35

标签: performance nhibernate profiling

我刚刚切换到Nhibernate2.1.0.4000 使用Nfluent 1.0RTM和Linq To Nhibernate 1.0.0。 突然间我发现现在是一个简单的session.Save需要一分钟而不是之前不超过10秒。当我切换回时间恢复正常... 我傻眼了。 有谁有同样的经历?什么可能导致阻力?一些改变了默认设置?

这是我要保存的实体:

Table("appendix");
        Id(x => x.id).GeneratedBy.Assigned();
        References(x => x.AppendixHierachy).Column("appendixHierarchyId");
        Map(x => x.appendix);
        Map(x => x.creatorEmpId);
        Map(x => x.disclaimerOffset);
        Map(x => x.fileExtension);
        References(x => x.Language).Column("languageId");
        References(x => x.MifidCompliance).Column("MifidComplianceId");
        Map(x => x.publishedDate);
        Map(x => x.reportPositionId);
        Map(x => x.summary).Length(7000);
        Map(x => x.thumbnailbyte).Columns.Add("thumbnail");
        Map(x => x.title);
        HasManyToMany(x => x.Instruments).Table("instAppendix").ParentKeyColumn("appendixId").ChildKeyColumn("instId").Cascade.All();
        HasOne(x => x.IBAppendix).Cascade.All();

我没有更改刚交换过Nhibenate,流利和LinqToNH库的代码。当然,根据改变的Nfluent Api进行调整..

这些是从SQLSERVER profiler

获取的命令
exec sp_executesql N'SELECT appendixhi_.id, appendixhi_.description as descript2_0_, appendixhi_.disclaimerOffset as disclaim3_0_, appendixhi_.displayName as displayN4_0_, appendixhi_.sortOrderId as sortOrde5_0_, appendixhi_.treeLevel as treeLevel0_, appendixhi_.parentId as parentId0_ FROM appendixHierarchy appendixhi_ WHERE appendixhi_.id=@p0',N'@p0 int',@p0=2529
go
exec sp_executesql N'INSERT INTO appendix (appendix, creatorEmpId, disclaimerOffset, fileExtension, publishedDate, reportPositionId, summary, thumbnail, title, appendixHierarchyId, languageId, MifidComplianceId, id) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12)',N'@p0 varbinary(max) ,@p1 int,@p2 int,@p3 nvarchar(3),@p4 datetime,@p5 int,@p6 nvarchar(2034),@p7 varbinary(2928),@p8 nvarchar(54),@p9 int,@p10 int,@p11 int,@p12 int',@p0=0x255044462D312E340D25E2E3CFD30D0A33332030206F626A203C3C2F4C696E656172697A656420312F4C2038373937322F4F2033352F452033333838302F4E20382F542038373236352F48205B2031313936203337305D3E3E0D656E646F626A0D20202020202020202020202020202020200D0A787265660D0A33332034350D0A30303030303030303136203030303030206E0D0A30303030303031353636203030303030206E0D0A30303030303031363632203030303030206E0D0A30303030303031383639203030303030206E0D0A30303030303032303134203030303030206E0D0A300303833323334203030303030206E0D0A30303030303833323639203030303030206E0D0A30303030303833323933203030303030206E0D0A30303030303833333931203030303030206E0D0A30303030303837303139203030303030206E0D0A747261696C65720D0A3C3C2F53697A652033333E3E0D0A7374617274787265660D0A3131360D0A2525454F460D0A,@p1=0,@p2=0,@p3=N'pdf',@p4='2009-04-01 12:10:31',@p5=0,@p6=N'Market growth tracking in line with guidance
AEO CFO Kathy Gramp presented at the UBS emerging companies conference. Guidance of “up to 5%” decline in metro radio advertising for 2H09 was unchanged from the 1H09 result. Despite a decline of just 2.7% for 2H09 to date, AEO indicated March is expected to be down 6-8% (albeit cycling Easter in March 2008). In addition, AEO’s forecast allows for a weaker June quarter, reflecting potential corporate belt-tightening into financial year-end. UBSe 2H09 -5%.

Radio a more resilient medium
The presentation highlighted that radio advertising has historically outperformed other traditional media during times of weak or negative growth (supported by CEASA data). We believe radio is also less affected by structural issues and note a decline of just 0.4% in radio’s share of total advertising spend over FY01-FY08, compared to -4.5% for FTA TV and -7.3% for newspapers.

Maintain Buy; defensive earnings with stable balance sheet
We maintain our Buy rating. We continue to view radio as a more defensive medium due to its lower cost and less exposure to multi-national ad budgets. AEO’s balance sheet remains conservative with UBSe FY09 Net Debt/EBITDA of 2.6x and FY09 EBITDA interest cover of 5.3x.

Valuation: $1.65 DCF-based target price (unchanged)
Our price target remains unchanged at $1.65. Our valuation is based on a 3-stage DCF model which assumes a 9.6% WACC and 3% terminal growth rate. Austereo now trades on a PE of 9.4x in FY09 and FY10, a 14% discount to the emerging industrials ex-financials in FY09, and a 5% discount in FY10.


 For a full version of this report, including disclosure information and analyst certification, please see the attached PDF or visit http://www.ubs.com/investmentresearch. For information on the ways in which UBS manages conflicts and maintains independence of its research product; historical performance information; and certain additional disclosures concerning UBS research recommendations, please visit http://www.ubs.com/disclosures.',@p7=0xFFD8FFE000104A46494600010101006000600000FFDB004300080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C180D0D1832211C213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232FFC0001108006E005503012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A4344454647484BCC24F84DAF59C667BDF1EDECB6EBF792469B69CF033893D6BD89BFE3EE3FFAE6FF00CD6997CC52D1D8315208208CFA8F4AE8A589A9495A3B7A213499E387E1273F854D0DB5ACCA1FCB0C7D4823F967FB5810368C1EFE61E3FF001DA7A49AB2A8FDCC658F50D21C0FFC76B47ECE9FDE97FEFEB7F8D1F674FEF4BFF7F5BFC69732EC0535B9D4500DF6B1B93D7121007FE3B527DA6F323FD0D39EBFBD3C7FE3B563ECE9FDE97FEFEB7F8D1F674FEF4BFF007F5BFC695D7602A8BABEC8DD62833E9313FF00B2D4D0CD70F2EC96DD635DB9DC1C9E7D3A0F7A93ECE9FDE97FEFEB7F8D1F674FEF4BFF007F5BFC68BAEC30B5FF008F487FEB9AFF002A2A455088A8A30AA300515207FFD9,@p8=N'Austereo Group "On track to meet guidance" (Buy) Moran',@p9=2529,@p10=101,@p11=110,@p12=10080793
go

exec sp_executesql N'INSERT INTO [IBAppendix] (RIXMLProductID, Appendix_id) VALUES (@p0, @p1); select SCOPE_IDENTITY()',N'@p0 nvarchar(8),@p1 int',@p0=N'uet09576',@p1=10080793

3 个答案:

答案 0 :(得分:0)

看看NHProfiler并分析封面下发生了什么。它将向您显示由于save方法而正在运行的SQL查询。你可以免费试用,但如果你是一个沉重的NHibernate用户,这很容易付出代价。也许有一些额外的东西发生,因为你有级联?

答案 1 :(得分:0)

一种选择是尝试运行.NET性能分析器以查看瓶颈所在。

RedGate's ANTS Profiler是一款商业产品,提供14天免费试用,过去对我有用,但也有other profiler products available。您可能会在较新版本的DLL中遇到错误或回归。

答案 2 :(得分:0)

一旦我在VS2008之外启动应用程序,问题就会消失。 有没有类似经历的人?