none
How can I get faster the first EF load? RRS feed

  • Question

  • Hello,

       My question is simple but I do not know if it's possible, you can streamline the load of an EF with 450 tables in its structure? I managed to spend 5 min to 2 min but still long to load.

       I know you will say I should separate the database in several EF, however, this solution is not practical for the following items:

       - The update time is a 1 RU 5 minutes, 10 EF upgrade takes 50 minutes!
       - Several of the tables field names have changed and how the tables are closely related, several of them would be repeated in several EF. That is rework.
       - How the tables are closely related, it may be necessary to reach levels of up to 6 levels in a query. This fact leads to the necessity of putting virtually all tables in the same EF, otherwise not have access to some data.

       Today I generate the EDMX file and the. Views.tt. With this the first time the load is approximately 2 minutes. There is no way to load the data that loads at once? I could not understand what examente is initialized on the first load. It would be interesting if it were loaded only tables Authentic

       My structure is VS 2010, EntityFramework 4.4.0 and the database is FireBird.

       Many thanks,

       Marco Castro
    Sunday, January 13, 2013 11:26 PM

All replies

  • Hi,

    The best source of information I can give you on this is the performance considerations for EF 5 article: http://msdn.microsoft.com/en-us/data/hh949853

    It has the most information about the various performance costs and known ways to mitigate them. However, I think that the answer to your problem is normally to pre-generate the views which is what you're doing with the views.tt file presumably. I will ask the EF performance engineer in case I am missing something and let you know if I find anything else.

    Another point is that we have done some work to improve the startup performance of complicated models in EF6, so you might get better performance with that. I would be interested in seeing the result if you tried out this model with EF6.

    As to your other question, are you asking for a method you could call on app start that does all of the warmup so the first user query doesn't have the hit?


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.

    Monday, January 14, 2013 7:39 PM
    Moderator
  • After talking with the performance engineer he thinks that your startup time should be in the order of seconds after pre-generating views.

    So some more information about your setup might help to find out what is going slowly. Are you using migrations that are executing on startup? Is this a web app? Is my assumption about you already pre-generating views correct?


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.

    Monday, January 14, 2013 8:51 PM
    Moderator