Hi All,

Myself Sudripto from Aspire Systems India. My company has recently
started working on Incorporating NHibernate for a DataLayer Module. As
requested I have created 2 prototypes for pumping huge data in some
tables. I have created a Data Access Object Library, A data Domain
library, A NUnit test Application and a Winform Application with a
Grid and some Insert Buttons.

The issue I am facing here is that While I call the session.Save
function from NUnit I can insert 8000 rows in 4 secs. While the same
call from Winforms for same number of rows is taking 20 mins.

I am doing Batch insert on both occasions. Both are calling the
session.Save inside a method in the common DataAccessObject library as
below.

        /// <summary>
        /// Insert Objects in Batch and then Commit
        /// </summary>
        /// <param name="objectList">List of Objects to Insert in
Batch</param>
        public void AddInBatch(IList<T> objectList)
        {
            ISession session = SessionManager.Instance.Session;
            //IStatelessSession statelessSession =
SessionManager.Instance.StatelessSession;
            ITransaction transaction = null;
            try
            {
                if (objectList.Count > 0)
                {
                    transaction = session.BeginTransaction();
                    //transaction =
statelessSession.BeginTransaction();
                    foreach (var objectType in objectList)
                    {
                        session.Save(objectType);
                        //statelessSession.Insert(objectType);
                    }
                    transaction.Commit();
                }
            }
            catch (Exception)
            {
                HandleError(transaction);
                throw;
            }
        }

I also tried with StatelessSession and had set the following in the
Winform applications configuration file
<property name="adonet.batch_size">100</property>. But did not get any
kind of significant improvement.

I further tried the same tests using Nhibernate profiler. I got the
results as follows

1. average insert statement in milliseconds from Winforms ----  47
seconds for 9000 rows
2. average insert statement in milliseconds from Nunit----  3 seconds
for 9000 rows

Another point to Note over here is that in Nh Profiler The NUnit
insert is showing an Alert: [Using a single session in multiple
threads is likely a bug]


I will be very grateful if someone can give some insight on this.
Thanks in Advance

Regards,
Sudripto

-- 
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.

Reply via email to