samedi 9 mai 2015

Entity Framework Intermittent Timouts On SaveChanges

We have been getting intermittent timeouts on calling SaveChanges with entity framework, I decided to turn on the Database.Log on DbContext to try and work out what was going on, the output was as follows:

Opened connection at 5/9/2015 4:56:57 PM +00:00

Started transaction at 5/9/2015 4:56:57 PM +00:00

UPDATE [Search].[IndexingStatuses]
SET [DateTimeLastUpdated] = @0, [IndexStores_IndexStoreId] = @1
WHERE ([CustomerId] = @2)

-- @0: '5/9/2015 4:03:57 PM' (Type = DateTime2)

-- @1: '2' (Type = Int16)

-- @2: '1' (Type = Int32)

-- Executing at 5/9/2015 4:56:57 PM +00:00

-- Completed in 1 ms with result: 1



Failed to commit transaction at 5/9/2015 4:57:13 PM +00:00 with error: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Closed connection at 5/9/2015 4:57:13 PM +00:00

This is very strange, it's a simple update and as you can see the transaction is started at 4:56:57, the update takes 1 ms but for some reason there is a timeout at 4:57:13 which is only 16 seconds later which is less than our timeout limit anyway.

Does anyone know why we are intermittently getting these?

Aucun commentaire:

Enregistrer un commentaire