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

Query: Auto-buffer data readers in SqlServer when split query & MARS off #21456

Merged
1 commit merged into from
Jun 29, 2020

Conversation

smitpatel
Copy link
Contributor

Resolves #21420

@smitpatel smitpatel requested a review from a team June 29, 2020 17:08
@smitpatel smitpatel force-pushed the smit/MARS branch 2 times, most recently from e7ff9dc to 51b8eec Compare June 29, 2020 19:31
@smitpatel smitpatel requested a review from roji June 29, 2020 19:32
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark results:

BenchmarkDotNet=v0.12.0, OS=ubuntu 20.04
Intel Xeon W-2133 CPU 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=5.0.100-preview.6.20318.15
  [Host]     : .NET Core 3.1.1 (CoreCLR 4.700.19.60701, CoreFX 4.700.19.60801), X64 RyuJIT
  DefaultJob : .NET Core 3.1.1 (CoreCLR 4.700.19.60701, CoreFX 4.700.19.60801), X64 RyuJIT

Method Mean Error StdDev
WithoutConcurrentDictionary 6,411.03 ns 33.443 ns 31.283 ns
WithConcurrentDictionary 96.99 ns 0.212 ns 0.177 ns

i.e. avoid parsing connection strings if at all possible :)

Benchmark code
public class Program
{
    private static readonly ConcurrentDictionary<string, bool> _cache
        = new ConcurrentDictionary<string, bool>();

    private const string ConnectionString =
        "Server=localhost;Database=test;User=SA;Password=Abcd5678;ConnectRetryCount=0;MultipleActiveResultSets=true";

    [Benchmark]
    public bool WithoutConcurrentDictionary()
        => new SqlConnectionStringBuilder(ConnectionString).MultipleActiveResultSets;

    [Benchmark]
    public bool WithConcurrentDictionary()
        => _cache.GetOrAdd(ConnectionString,
            cs => new SqlConnectionStringBuilder(ConnectionString).MultipleActiveResultSets);

    static void Main(string[] args)
        => BenchmarkRunner.Run<Program>();
}

Base automatically changed from smit/displosalfacility to master June 29, 2020 19:58
@ghost
Copy link

ghost commented Jun 29, 2020

Hello @smitpatel!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 63d890d into master Jun 29, 2020
@ghost ghost deleted the smit/MARS branch June 29, 2020 23:38
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure MARS in SqlServer
4 participants