Skip to content

Instantly share code, notes, and snippets.

@dimalyshev
Created May 21, 2020 14:01
Show Gist options
  • Save dimalyshev/1854e2d6ed51da7fcbd4846fe4349f44 to your computer and use it in GitHub Desktop.
Save dimalyshev/1854e2d6ed51da7fcbd4846fe4349f44 to your computer and use it in GitHub Desktop.
Stress test for MQ connection
rem Reproduce connection multiplication on RabbitMQ shutdown
rem Use rabbitmqctl, sor REQUIRES
rem set PATH=%PATH%;"c:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.3\sbin"
echo off
del demo-*.log demo-connections-*.log
set OUTPUT=demo-connections-%date%.log
:: RUN dotnet run
dotnet build --nologo -v q %1 >nul
::run
:: prepare demo env
set rabbitmquri=amqp://localhost
set serilog:writeto:0:name=Console
set serilog:minimumlevel=Verbose
set dbconnectionstring=Server=(localdb)\.;Database=storedb
set EventBusRetryCount=5
::run app
start "Demo" cmd /c dotnet run --no-build --no-launch-profile -p %1 --environment demo ^>demo-%date%.log
echo ==== starting simulation
for /L %%i in (1,1,5) do (
echo shutdown #%%i
call:kick_all %%i >>%OUTPUT%
)
goto:eof
rem SHUTDOWN SIMULATION
:kick_all
timeout /t 3 >nul
set NAME="My connection break #%1"
echo ===== MQ connections before: %NAME%
cmd /c "rabbitmqctl list_connections channels vhost name"
cmd /c "rabbitmqctl close_all_connections %NAME%"
goto:eof
@dimalyshev
Copy link
Author

Script to test behaviour on MQ connection shutdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment