First of all I need to mention that I am not posing this question to negatively question NHibernate but only ask the question because it is a real life problem for me as of now.
I am trying to save an Aggregate a Price, this has one set of CostComponents, pretty straight forward (it has an inheritance so that the cost component can be of two types). The issue is that I will need to save a lot of these. Several thousands and I am having problems with performance. I have tried using Session with batch size, this seemed to improved performance some but not immensely. I tried using stateless Session and this made it slight better still, but I am still performing poorly. (I did it in two steps, first prices and then the components) I then tried plain old ADO.Net (with batch size) and it went some 10 times faster and met the performance needs I had. Today with the setup of machines I have for testing (a pretty ordinary virtual db-server with two processors and 4 GB memory) it takes me 70 sec to save 1000 prices with 4 components each (total of 5000 entities) with batch size and ordinary Session (I have tried different sizes from 10 to 1000 and I do Session.Flush and Clear every 100 entity). With the stateless approach it took less, some 50 seconds or so. With ADO.Net it took 5 seconds. Again, I am not in anyway trying to put NHibernate down but rather ask the question if this is excepted or if I am doing something wrong? I am not an experienced NHibernate user so I might very well be doing something wrong. I read a discussion about batch-size and generators but I didn’t really understand the issue. I am using generator identity and I got that much, this was not the favourite choice. But I didn’t get if this somehow destroyed the batching? (When I trace the db-calls using SQL-Profiler I haven’t found a way to distinguish if the calls sent are sent in batch or not. Is there any way to tell?) My Price class has six properties (three of these are many-to-one) and my CostComponent has three (one many-to-one). Does anyone have any experience regarding this? I am using NHibernate version 2.1.2.4000. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
