It sounds very much like the ordinary "time to dirty check increases by number of objects in session" and "avoid querying in a loop (especially if your session's object count is increasing)".
If you set session.FlushMode to Never (and call Flush() manually after the loop), does it work any better then? /Oskar 2013/8/30 Nicolas Vinot <[email protected]> > Hello everybody, > > I have a huge problem of performance degradation with NHibernate. > I create a simple demo program, enclosed to this post, which show the > problem. > > I have a simple domain, Foo(long id, string text) and Bar(long id, string > text). > No association between them. > I create a single Foo, then loop X times, fetching the Foo by it text and > create 5000 Bar. > > *On each lap, the fetch of the Foo take more and more time, from 20ms the > first **lap to 1500ms on the 50th or 3000ms on the 100th.* > > 0 Get Foo string -> 00:00:00.1402016 > 10 Get Foo string -> 00:00:00.2103024 > 20 Get Foo string -> 00:00:00.5007200 > 30 Get Foo string -> 00:00:00.8111664 > 40 Get Foo string -> 00:00:01.3419296 > 50 Get Foo string -> 00:00:01.4320592 > 60 Get Foo string -> 00:00:01.5121744 > 70 Get Foo string -> 00:00:01.8726928 > 80 Get Foo string -> 00:00:02.0729808 > 90 Get Foo string -> 00:00:02.7339312 > 100 Get Foo string -> 00:00:03.4149104 > > I search a lot what can cause this problem (query cache, index, flush > session, evict from cache, SQLite and PostgreSQL…), but not success. > On my real application (some associations and more columns), the problem > is worst, with 5000ms on the 10th loop, leading to totally not usable > application with few thousand of data. > I don't remember such a problem on Java Hibernate. > > Can anybody help me to locate the cause of the problem ? > > Thanks in advance ! > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.
