Skip to content
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 between 7.10.1 and 8.0.1 [DNET1042] #953

Closed
firebird-automations opened this issue Apr 19, 2021 · 4 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Rand Random (rand.random)

The performance to read data dropped to half between 7.10.1 and 8.0.1.
On 7.10.1 my test finishes with 11.14 s.
On 8.0.1 my test finishes with 28.72 s.

I have created this github project with the code demonstrating my issue
https://github.com/Rand-Random/FbPerf

Only this file contains code:
https://github.com/Rand-Random/FbPerf/blob/main/FbPerf8/FbPerfTest.cs

This *.cs file reads 1 million rows from a database containing 5 million records.
You can find the used database 7-zipped as TESTPERF.7z in the root of the github project, the file FbPerfTest.cs also contains code how I created/filled the test database, in case it is relevent.

The C#⁠ project FbPerf7 has the NuGet package for 7.10.1, while the C#⁠ project FbPerf8 has the NuGet package version 8.0.1.
I am using BenchmarkDotNet for the performance tests, I added the results as images into the root of the github project.
The perf7.jpg contains the result for the FbPerf7 C#⁠ project, and the perf8.jpg for the FbPerf8 C#⁠ project.

Please be aware of the fact that the folder FbPerf7 only contains the *.csproj file and not a single *.cs file, this is because I am linking existing files from the FbPerf8 folder, I do this to avoid writing the test twice.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Yes, this is partly expected. The async support added non-trivial pieces of code and for a "non-parallel" workloads this adds up. It's on my radar to start chopping pieces and improve it, but also with scalability in mind. I already have some pieces tested with small improvements.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: vNext [ 10982 ]

@firebird-automations
Copy link
Author

Commented by: Rand Random (rand.random)

I have added a parallel workload to my test project.
Currently it is faster to wrap code from the 7.10.1 version inside Task.Run than to use 8.0.1 async feature.

On 7.10.1 my test finishes in parallel with 6.12 s, compared to ~ 11s not executing in parallel.
On 8.0.1 my test finishes in parallel with 16.01 s, compared to ~ 28s not executing in parallel.
Running non parallel differs slightly if I use non async methods or async methods or if I wrap code inside Task.Run, though everything seems in the margin of error.

I have split up the process of reading 1 million records into 10 tasks each reading 100.000 records.

To read the data in blocks of 100.000 records I have altered FOO1 in the table FOO to have a primary key to get an index read for the query.
select * from foo where foo1 between 0 and 100000

You can find the altered database in TESTPERFv2.7z.
The updated results with the 2 new benchmarks for parallel execution can be found in per7 - parallel.jpg and per8 - parallel.jpg.

@cincuranet
Copy link
Member

I did a quick look today. As expected the state machines generated are not helping. I need to dig into it and try to lower the impact (without implementing (and maintaining) everything twice).

Other thing to consider is whether the communication is over localhost or "real" network. Because with real network there's real asynchronicity.

Over Internet, with 20k fetches:

Version Time
7.10.1 25.62 s
8.0.1 25.21 s

Obviously that doesn't mean the localhost performance is not important. Quite the contrary.

cc @Rand-Random

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants