views:

107

answers:

3

I just switched to Nhibernate2.1.0.4000 with Nfluent 1.0RTM and Linq To Nhibernate 1.0.0. Suddenly I found that now a simple session.Save takes a minute compared to before not more than 10 secs. As I switch back times are back to normal... I dumbfounded. Has anyone made the same experience? What could cause the drag ? some changed default setting?

This is the entity I want to save:

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();

I did not change the code just exchanged the Nhibenate, fluent and LinqToNH libs. and of course made adjustments according to the changed Nfluent Api..

These are the Commands obtained from 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
A: 

Take a look at NHProfiler and analyze what's going on under the cover. It'll show you exactly what SQL queries are being run as a result of the save method. You can get a free trial but it's easily worth the price if you're a heavy NHibernate user. Perhaps there's some extra stuff happening because of the cascades you have?

Chris Conway
My version already expired(used it at the beginning) Yes, I also suspect it has to do something with the cascades and the HasManyToMany relation. Since with the new version I found that the relation is not being saved even after Transaction is closed.
urpcor
NH profiler also has the thinking time while calling Save(). No alerts in NHProfiler....
urpcor
A: 

One option is to try to run a .NET performance profiler to see where the bottleneck is.

RedGate's ANTS Profiler is a commercial product with a 14 day free trial that has worked well for me in the past, but there are other profiler products available as well. It's possible you've run across a bug or a regression in the newer versions of the DLLs.

Michael Maddox
Now I did with ANTS:54 % of the time by calling SAVE() are spent with the AbstractBAtcher.Prepare which calls AbstractBatcher.LogCommand()then there is Byte.ToString called and stringbuilder.append(Half/half) Then under Byte.ToString it tries to get some current culture. this alone costs 12% of time.
urpcor
A: 

The issue goes away as soon as I start the application outside VS2008. Is there anyone with similar experiences?

urpcor
it has to do with some byte[] array I am going to save. http://stackoverflow.com/questions/1861180/persisting-byte-to-image-db-field
urpcor