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

Tune maximum connection pool size for Npgsql, enable multiplexing for non-platform benchmarks #1667

Merged
merged 3 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scenarios/database.benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
arguments: "--nonInteractive true --scenarios {{scenario}} --urls {{serverScheme}}://{{serverAddress}}:{{serverPort}} --server {{server}} --kestrelTransport {{transport}} --protocol {{protocol}}"
environmentVariables:
database: PostgresQL
connectionString: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
connectionString: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000

postgresql:
source:
Expand Down
20 changes: 4 additions & 16 deletions scenarios/platform.benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
project: src/BenchmarksApps/Kestrel/PlatformBenchmarks/PlatformBenchmarks.csproj
readyStateText: Application started.
framework: net5.0

environmentVariables:
database: PostgreSQL
connectionstring: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=18;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000

postgresql:
source:
repository: https://github.com/TechEmpower/FrameworkBenchmarks.git
Expand Down Expand Up @@ -56,9 +59,6 @@ scenarios:
job: platformbenchmarks
buildArguments:
- "/p:IsDatabase=true"
environmentVariables:
database: PostgreSQL
connectionstring: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000
load:
job: wrk
variables:
Expand All @@ -73,9 +73,6 @@ scenarios:
job: platformbenchmarks
buildArguments:
- "/p:IsDatabase=true"
environmentVariables:
database: PostgreSQL
connectionstring: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000
load:
job: wrk
variables:
Expand All @@ -89,9 +86,6 @@ scenarios:
job: platformbenchmarks
buildArguments:
- "/p:IsDatabase=true"
environmentVariables:
database: PostgreSQL
connectionstring: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
load:
job: wrk
variables:
Expand All @@ -105,9 +99,6 @@ scenarios:
job: platformbenchmarks
buildArguments:
- "/p:IsDatabase=true"
environmentVariables:
database: PostgreSQL
connectionstring: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
load:
job: wrk
variables:
Expand All @@ -121,9 +112,6 @@ scenarios:
job: platformbenchmarks
buildArguments:
- "/p:IsDatabase=true"
environmentVariables:
database: PostgreSQL
connectionString: Server={{databaseServer}};Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4
load:
job: wrk
variables:
Expand Down
4 changes: 2 additions & 2 deletions src/Benchmarks/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void ConfigureServices(IServiceCollection services)
case DatabaseServer.PostgreSql:
services.AddEntityFrameworkNpgsql();
var settings = new NpgsqlConnectionStringBuilder(appSettings.ConnectionString);
if (!settings.NoResetOnClose)
throw new ArgumentException("No Reset On Close=true must be specified for Npgsql");
if (!settings.NoResetOnClose && !settings.Multiplexing)
throw new ArgumentException("No Reset On Close=true Or Multiplexing=true implies must be specified for Npgsql");
if (settings.Enlist)
throw new ArgumentException("Enlist=false must be specified for Npgsql");

Expand Down