I have this happening from time to time on my Production application.
My scenario is a simple one, as follows:
using (var ctx = new MyDbContext())
{
ctx.SMSReplies.Add(new SMSReply
{
//Set properties here
});
ctx.SaveChanges();
}
Occasionally this fails with the following error:
System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details.
---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details.
---> System.Data.SqlClient.SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.
---> System.ComponentModel.Win32Exception: The wait operation timed out
I know I could increase the command timeout of my DbContext, but that's not the point; my concern runs deeper than that...
The default timeout is 30 seconds, and so my concern is...what on earth can be going on in my database that can cause a simple insert of a line into a table with less than 5000 rows to take longer than 30 seconds?!?!
Any DBA's out there that can guide me on what performance monitoring and tuning I should be doing on my database to shed light on the root cause?