14 lines
896 B
Batchfile
14 lines
896 B
Batchfile
@echo off
|
|
setlocal EnableDelayedExpansion
|
|
|
|
echo [Warmup] Waiting for Matab web server on port 8000...
|
|
powershell -NoProfile -Command ^
|
|
"$ok=0; for($i=0;$i -lt 120;$i++){try{$t=New-Object Net.Sockets.TcpClient;$t.Connect('127.0.0.1',8000);$t.Close();$ok=1;break}catch{Start-Sleep -Milliseconds 500}}; if(!$ok){Write-Host '[Warmup] Timeout - server not ready.'; exit 1}"
|
|
if %errorlevel% neq 0 exit /b 1
|
|
|
|
echo [Warmup] Firing 10 parallel requests to warm up all 8 PHP workers...
|
|
powershell -NoProfile -Command ^
|
|
"$urls='http://localhost:8000/','http://localhost:8000/matab/login'; $jobs=@(); 1..10|ForEach-Object{$u=$urls[($_ %% 2)]; $jobs+=Start-Job -ScriptBlock{param($u)try{Invoke-WebRequest $u -TimeoutSec 60 -UseBasicParsing -ErrorAction SilentlyContinue|Out-Null}catch{}} -ArgumentList $u}; $jobs|Wait-Job|Out-Null; $jobs|Remove-Job"
|
|
|
|
echo [Warmup] PHP OPcache warmed up successfully.
|