-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Massive performance decrease on Migrate #30077
Comments
Possible dup of #29642, which has been fixed for 7.0.3. Can you drill down and verify which method is taking up the time under AddDefaultMappings? |
Can you please try with the latest daily build of 8.0, where #29642 has been fixed? |
I will try it in the next days. Had no time to do it today. |
@JakobFerdinand how much was it taking with 2.2? Can you also try with the latest 6.0 version to exclude some regression in 7.0? |
In EF Core 2.2.6 the I´m sorry but I can´t do the regression test with 6.0. |
My question was how long the whole process takes on 2.2.6; since you reported that the latest 7.0 takes 1.8 seconds instead of 6 seconds, it's important to compare than against 2.2.6 (maybe there's no more regression). |
As you can see in the screenshots the times mentioned above is only the time consumed by Comparing the over all time is also not representative because of our migration merge after the change to 7.0. One thing that can be compared is the method |
I'm confused - you're writing here that 7.0.0/7.0.3 are only a bit slower than 2.2.6 (~230ms), but also that the latest release/7.0 (i.e. 7.0.3) branch is significantly faster than 7.0.0 (1.8 seconds instead of 6 seconds). Not saying there isn't a problem, but can you provide a bit of clarity here? 7.0.3 has bug fix #29642 which could be affecting perf in a massive way. What we ideally need is a one-to-one comparison between 7.0.3 and e.g. 2.2.6, to see where we actually stand. |
Yes I will try to provide some more clarity. :D If we take a look at the
Let´s focus on
The second part is
Important: The model in both screenshots is about the same. But in 7.0.0 all migrations have been merged together to save time. Does that answer your questions? :) |
To a certain extent :) Putting aside the perf issue that #29642 fixed, we don't learn much from focusing on FinalizeModel(), precisely because it didn't exist in 2.2; whatever FinalizeModel does in modern EF versions is probably spread out across other methods in 2.2 - it's most probably not the case that it's an added 1800ms in 7, compared to 2.2. This is why I'm not looking for how much specific methods took in the profiler - it's generally not very useful to simply compare specific method profiler times across versions, since things changed overall. What's interesting is an apples-to-apples comparison of the entire operation, i.e. Migrate as a whole. If I understand correctly, you can't produce this since you've already merged the migrations in 7.0.0, so an apples-to-apples comparison isn't possible. To summarize: are you saying that you think there's still a perf problem in 7.0, after #29642? |
We created a special version of our program to create a direct comparison. In both cases the same 366 migrations were executed by creating a new empty database.
As a summary I would say there is no regression from 2.2.6 to 7.0.3. Can be closed. |
@JakobFerdinand thank you very much for doing the apples-to-apples comparison - it's good to see confirmation that there's no regression here. Please don't hesitate to write back if you encounter further issues. |
Duplicate of #29642 |
Performance decrease on migrate
We upgraded our project from EF 2.2.6 to EF 7.0.
Now we notice a massive performance decrease on
dbContext.Database.Migrate()
.We built a feature around that method where we migrate old databases during runtime.
We have a very big model with about 400 entity types.
Several teams are creating migrations independently -> we create about 250 migrations a year.
For maintenance we aggregate the migrations on regular bases.
Since we did that just after the migration the following measurement ist with only 10 migrations.
In the profiling screenshot you can see, that the creation of the relational model takes most of the time.
Include provider and version information
EF Core version: 7.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 7.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.4
The text was updated successfully, but these errors were encountered: