My company has a basic SOA, using Entity Framework for database access. One of our services must interface with a legacy database which uses uniqueidentifier
primary keys in the database. Performance is good during unit and integration testing.
However, under load, the affected service starts to produce a backlog of queued requests. This queue can be eliminated by removing the code sections which use Entity Framework to match rows by uniqueidentifier PK. The service then becomes performant again, matching rows by integer PK as part of the same routines, using the same ObjectContext.
The database table performs well being queried by the legacy application which it was designed for. I therefore do not believe this problem to be related to fragmentation within the database/index.
In the code sample shown, domain
is an Entity Framework ObjectContext, MetaSetting
relates to the mapped EntityObject and match.ObjectId
is a Guid
.
metaSettings = domain.MetaSetting.Where(
ms => ms.AppUID.Equals(match.ObjectId)
).ToList();