Protecting backend services from sudden connection concurrency surges requires rigorous load limit validation. Traefik’s InFlightReq middleware restricts the maximum number of simultaneous requests allowed across reverse proxy routes. Windows Sandbox on Windows 11 provides a fast, disposable virtualised testbed to test concurrency limiting configurations safely without risking host workstation instability.
Understanding InFlightReq Concurrency Limiting
Unlike rate-limiting (which counts requests over time intervals), InFlightReq limits the exact number of active, incomplete HTTP transactions. Once active in-flight requests reach the threshold, Traefik immediately rejects additional requests with HTTP 429 Too Many Requests, preventing downstream database connection pool exhaustion.
Authoring the Windows Sandbox WSB XML
Save the following XML document as TraefikInFlightSandbox.wsb on your Windows 11 machine:
<Configuration>
<VGpu>Default</VGpu>
<Networking>Default</Networking>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\TraefikInFlightLab</HostFolder>
<SandboxFolder>C:\TraefikInFlightLab</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\TraefikInFlightLab\setup-inflight.ps1</Command>
</LogonCommand>
</Configuration>
PowerShell Deployment Bootstrapper
Save the bootstrapping script as C:TraefikInFlightLabsetup-inflight.ps1:
Write-Host "Initialising Traefik InFlightReq Lab..." -ForegroundColor Cyan
$Dir = "C:Traefik"
New-Item -ItemType Directory -Force -Path $Dir | Out-Null
$ZipUrl = "https://github.com/traefik/traefik/releases/download/v3.0.0/traefik_v3.0.0_windows_amd64.zip"
Invoke-WebRequest -Uri $ZipUrl -OutFile "$Dir raefik.zip"
Expand-Archive -Path "$Dir raefik.zip" -DestinationPath $Dir -Force
$Config = @"
http:
middlewares:
limit-concurrency:
inFlightReq:
amount: 5
sourceCriterion:
ipStrategy:
depth: 1
routers:
load-router:
rule: "PathPrefix(`/heavy`)"
middlewares:
- "limit-concurrency"
service: "backend-service"
services:
backend-service:
loadBalancer:
servers:
- url: "http://127.0.0.1:8080"
"@
Set-Content -Path "$Dirdynamic_conf.yml" -Value $Config
Write-Host "Traefik InFlightReq Middleware Configured for Max 5 Concurrent Sockets." -ForegroundColor Green
Simulating Concurrency Limits
Double-click the .wsb file to boot the sandbox. Launch six concurrent curl requests in separate PowerShell tabs to verify that the sixth request is immediately rejected with HTTP 429 while the initial five complete successfully.