Reputation: 4528
I have a very large Entity Framework implementation (100+ tables/entities). The first time SaveChanges is called when doing an update I am experiencing an 18 second wait time. Is this common for large entity framework models? I heard that partitioning the EF model into smaller chunks is a way to improve performance. I am wondering if this is the only way? Partitioning at this point seems like a whole lot of work.
Thanks!
Upvotes: 2
Views: 1320
Reputation: 11
I am seeing the same problem in a project of mine. The first call to SaveChanges takes about 12 seconds and full cpu time, the following calls don't.
The first polling of entities took about the same time before I used pregenerated Views. Now the 12 second first time polling delay is gone, but the first SaveChanges call still takes that long. Perhaps there is a way to pregenerate some code for SaveChanges too...
[Edit] I just wanted to mention that I managed to get rid of the delay at the first save, by changing the database structure. The Entity for which saving took so long was a big table with a lot of foreign key constraints to another table (don't ask). Removing the foreign key constraints did the trick. [/Edit]
Upvotes: 1
Reputation: 65381
The place where we save most data in EF in a single operation, is several hundred rows spread over ca. 80 tables. This has a sub second response time.
It must be related to something else, things to check are:
Upvotes: 0
Reputation: 126547
No, this is not expected behavior. Our entity model is as large as yours and we don't see this. You need to profile your application to figure out what the problem actually is before you go off trying to solve it. I can't propose a solution for you without knowing what your profiling results are.
Upvotes: 0