-
Notifications
You must be signed in to change notification settings - Fork 547
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
Performance regression in query plan compilation under load on .Net Core #1794
Comments
Random question, but how do you do 64 threads on say.... |
As I learn more about BenchmarkDotNet, I was able to run all the cases in one benchmark for easier comparison. Run with BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19042
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
[Host] : .NET Framework 4.8 (4.8.4300.0), X64 RyuJIT
Job-EJNHXU : .NET Framework 4.8 (4.8.4300.0), X64 RyuJIT
Job-IRUXDQ : .NET Framework 4.8 (4.8.4300.0), X64 RyuJIT
Job-SHNZVZ : .NET Core 3.1.10 (CoreCLR 4.700.20.51601, CoreFX 4.700.20.51901), X64 RyuJIT
Server=True Arguments=/p:AutoGenerateBindingRedirects=false,/p:GenerateSupportedRuntime=false RunStrategy=Monitoring
|
@Seabizkit Sure, I may have gone overboard with this. OTOH, it doesn't show regression on both, but rather it confirms the trend of EF on .net core underperforming under load more and more. |
This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which means we will only make changes to address security issues. See the repo README for more information. |
We just spend 8 month trying to understand why our application freshly migrated from .NET4.8 could not handle the load, never thinking that the time spent compiling plans was abnormal of all things. We now have to migrate to EF Core, which is no little task. This issue should be clearly advertised in this repo's front page, and serve as a warning for anyone trying to migrate big apps to dotnet core, while still using EF 6. |
We've seen the same problem this week. In some cases, the loss of time due to the use of ConcurrentBag is greater than 30%. Have you tested a return to EF6.3? We haven't had time to do so yet. We are also considering the creation of a custom version without the PR that introduces this counter-productive 'optimization' (#430). |
I believe there's a performance regression in query plan compilation under load with EF 6.4.4 on .Net Core 3.1.
Background
We run a somewhat active web application. We have recently upgraded it from net48 and EF 6.2.0 to netcoreapp3.1 and EF 6.4.4.
The application has been long in development so some patterns used there are not necessarily up to date. In particular there's a considerable amount of synchronous IO. This, I think, puts pressure on the thread pool which often runs with elevated number of worker threads (2x - 3x the default, i.e. equal to the number of CPUs). When it happens, we see sustained, increased processor usage making the application slow.
Traces that we took point to EF query plan compilations (which happen in our case because some of the frequent queries in the app don't get cached) and specifically to the use of ConcurrentBag in BitVec.ArrayPool..
Benchmarks
I've tried to show the issue with BenchmarkDotNet benchmarks. Below are the results of it. Note that I'm completely new to BenchmarkDotNet. Still, I think it shows there's an issue.
Benchmarks are completely synthetic, all they do is compile a plan for a non trivial query in a loop on multiple threads in parallel.
Base benchmark class is taken from grpc project (https://github.com/grpc/grpc/blob/master/src/csharp/Grpc.Microbenchmarks/CommonThreadedBase.cs)
Edit: I managed to run all the cases in one benchmark. Results in a comment further below: #1794 (comment)
Benchmarks were run on a 4 core cpu (8 logical cores). There are three comparisons (results and project sources further below):
EF 6.4.4 net48 V. EF 6.4.4 netcoreapp3.1
TestEFRecompilation_644_644.zip
EF 6.2.0 net48 V. EF 6.4.4 netcoreapp3.1
TestEFRecompilation_620_644.zip
EF 6.2.0 net48 V. EF 6.4.4 net48
TestEFRecompilation_620_644_net48.zip
Benchmark code
Benchmark code is basically the following, see zip archives for actual projects.
The text was updated successfully, but these errors were encountered: