Skip to content

Commit

Permalink
Tune maximum connection pool size for Npgsql, enable multiplexing for…
Browse files Browse the repository at this point in the history
… non-platform benchmarks (#1667)
  • Loading branch information
NinoFloris committed May 5, 2021
1 parent c6d3f5c commit d72cf79
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
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

0 comments on commit d72cf79

Please sign in to comment.