views:

160

answers:

1

Our application (which uses NHibernate and ASP.NET MVC), when put under stress tests throws a lot of NHibernate transaction errors. The major types are:

  1. Transaction not connected, or was disconnected
  2. Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
  3. Transaction (Process ID 177) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Can someone help me in identifying the reason for Exception 1? I know I have to handle the other exceptions in my code. Can someone point me to resources which can help me handle these errors in an efficient manner?

Q. How do we manage Sessions and Transactions?

A. We are using Autofac. For every server request, we create a new request container which has the session in the container lifetime scope. On activating the session we begin the transaction. When the request completes, we commit the transaction. In some cases, the transaction can be huge. To simplify, every server request is contained in a transaction.

A: 

By stress do you mean millions of database entries? If so, have a look at the following post:

Rafael Belliard
No. We ran a stress test on the web application using JMeter simulating numerous users working on the site simultaneously
Zuber