ASP.NET Core Benchmarking on Ubuntu using Docker

Disclaimer: I am trying to learn how to do ASP.NET Core benchmarks using Docker. This could help developers to benchmark their Web Apps in order to improve their performance.
docker build -t benchmarks -f Dockerfile ../../
param(
 [string]$ServerIp="",
 [string]$HardwareVersion="",
 [string]$Hardware="",
 [string]$Url="",
 [string]$Name="" 
 )

$PostgreSql='--postgresql "Server=TFB-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;NoResetOnClose=true;Max Auto Prepare=3"'
$MySql='--mysql "Server=TFB-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;SslMode=None;ConnectionReset=false"'
$MsSql='--mssql "Server=TFB-database;Database=hello_world;User Id=sa;Password=Benchmarkdbp@55;Max Pool Size=100;"'
$MongoDb='--mongodb "mongodb://TFB-database:27017?maxPoolSize=1024"'

# "--network host" - Better performance than the default "bridge" driver
# "-v /var/run/docker.sock" - Give container access to the host docker daemon 
docker run `
     -d `
     --log-opt max-size=10m `
     --log-opt max-file=3 `
     --name benchmarks-server `
     -p 5001:5001 `
     --restart always `
     -v /var/run/docker.sock:/var/run/docker.sock `
     benchmarks `
     bash -c `
     "dotnet run -c Debug --project src/BenchmarksServer/BenchmarksServer.csproj -n 10.0.75.0 --url http://*:5001 --hardware physical --hardware-version laptop"
docker run `
    -d `
    --log-opt max-size=10m `
    --log-opt max-file=3 `
    --name benchmarks-client `
    -p 5002:5002 `
    --restart always `
    benchmarks `
    dotnet run -c Debug --project src/BenchmarksClient/BenchmarksClient.csproj
docker stop benchmarks-server
docker rm benchmarks-server
docker stop benchmarks-client
docker rm benchmarks-client
docker run `
    -d `
    --log-opt max-size=10m `
    --log-opt max-file=3 `
    --name benchmarks-client `
    -p 5002:5002 `
    --restart always `
    benchmarks `
    dotnet run -c Debug --project src/BenchmarksClient/BenchmarksClient.csproj
param(
 [string]$ServerIp="",
 [string]$HardwareVersion="",
 [string]$Hardware="",
 [string]$Url="",
 [string]$Name="" 
 )

$PostgreSql='--postgresql "Server=TFB-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;NoResetOnClose=true;Max Auto Prepare=3"'
$MySql='--mysql "Server=TFB-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;SslMode=None;ConnectionReset=false"'
$MsSql='--mssql "Server=TFB-database;Database=hello_world;User Id=sa;Password=Benchmarkdbp@55;Max Pool Size=100;"'
$MongoDb='--mongodb "mongodb://TFB-database:27017?maxPoolSize=1024"'

# "--network host" - Better performance than the default "bridge" driver
# "-v /var/run/docker.sock" - Give container access to the host docker daemon 
docker run `
     -d `
     --log-opt max-size=10m `
     --log-opt max-file=3 `
     --name benchmarks-server `
     -p 5001:5001 `
     --restart always `
     -v /var/run/docker.sock:/var/run/docker.sock `
     benchmarks `
     bash -c `
     "dotnet run -c Debug --project src/BenchmarksServer/BenchmarksServer.csproj -n 10.0.75.0 --url http://*:5001 --hardware physical --hardware-version laptop"

Hi, I'm Maher, Development Technologies MVP. I'm blogging about ASP.NET Core.