|
| 1 | +# RabbitMQ Chaos Testing |
| 2 | + |
| 3 | +A 3-node RabbitMQ cluster with constrained resources for testing failure scenarios. |
| 4 | + |
| 5 | +## Cluster Nodes |
| 6 | + |
| 7 | +| Node | AMQP Port | Management UI | Disk Limit | Memory Limit | |
| 8 | +|------|-----------|----------------------------|------------|--------------| |
| 9 | +| 1 | 5672 | <http://localhost:15672> | 50MB | 384MB | |
| 10 | +| 2 | 5673 | <http://localhost:15673> | 75MB | 448MB | |
| 11 | +| 3 | 5674 | <http://localhost:15674> | 100MB | 512MB | |
| 12 | + |
| 13 | +Node 1 has the tightest limits and will fail first under load. |
| 14 | + |
| 15 | +**Credentials:** `guest` / `guest` |
| 16 | + |
| 17 | +## Quick Start |
| 18 | + |
| 19 | +```powershell |
| 20 | +./scripts/Start.ps1 |
| 21 | +./scripts/Status.ps1 |
| 22 | +./scripts/Stop.ps1 |
| 23 | +``` |
| 24 | + |
| 25 | +## Scripts |
| 26 | + |
| 27 | +```powershell |
| 28 | +./scripts/Start.ps1 |
| 29 | +./scripts/Stop.ps1 |
| 30 | +./scripts/Status.ps1 |
| 31 | +./scripts/FillDisk.ps1 |
| 32 | +./scripts/FillDisk.ps1 2 |
| 33 | +./scripts/FillDisk.ps1 1 40 |
| 34 | +./scripts/ClearDisk.ps1 |
| 35 | +./scripts/ClearDisk.ps1 2 |
| 36 | +./scripts/KillNode.ps1 |
| 37 | +./scripts/KillNode.ps1 2 |
| 38 | +./scripts/KillNode.ps1 1 -Restart |
| 39 | +./scripts/Reset.ps1 |
| 40 | +``` |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Test Scenarios |
| 45 | + |
| 46 | +### Start cluster first |
| 47 | + |
| 48 | +```powershell |
| 49 | +cd chaos-testing |
| 50 | +./scripts/Start.ps1 |
| 51 | +``` |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +### Basic pub/sub |
| 56 | + |
| 57 | +```powershell |
| 58 | +cd samples/Foundatio.RabbitMQ.Subscribe |
| 59 | +dotnet run |
| 60 | +``` |
| 61 | + |
| 62 | +```powershell |
| 63 | +cd samples/Foundatio.RabbitMQ.Publish |
| 64 | +dotnet run |
| 65 | +``` |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +### Single node connection |
| 70 | + |
| 71 | +```powershell |
| 72 | +cd samples/Foundatio.RabbitMQ.Subscribe |
| 73 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672" |
| 74 | +``` |
| 75 | + |
| 76 | +```powershell |
| 77 | +cd samples/Foundatio.RabbitMQ.Publish |
| 78 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672" |
| 79 | +``` |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +### Failover connection (all 3 nodes) |
| 84 | + |
| 85 | +```powershell |
| 86 | +cd samples/Foundatio.RabbitMQ.Subscribe |
| 87 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672,localhost:5673,localhost:5674" |
| 88 | +``` |
| 89 | + |
| 90 | +```powershell |
| 91 | +cd samples/Foundatio.RabbitMQ.Publish |
| 92 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672,localhost:5673,localhost:5674" |
| 93 | +``` |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +### Durable queues (survive restarts) |
| 98 | + |
| 99 | +```powershell |
| 100 | +cd samples/Foundatio.RabbitMQ.Subscribe |
| 101 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672" --durable |
| 102 | +``` |
| 103 | + |
| 104 | +```powershell |
| 105 | +cd samples/Foundatio.RabbitMQ.Publish |
| 106 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672" --durable |
| 107 | +``` |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +### Large messages (1MB - memory pressure) |
| 112 | + |
| 113 | +```powershell |
| 114 | +cd samples/Foundatio.RabbitMQ.Publish |
| 115 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672" --message-size 1048576 |
| 116 | +``` |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +### Delayed messages |
| 121 | + |
| 122 | +```powershell |
| 123 | +cd samples/Foundatio.RabbitMQ.Subscribe |
| 124 | +dotnet run --delayed |
| 125 | +``` |
| 126 | + |
| 127 | +```powershell |
| 128 | +cd samples/Foundatio.RabbitMQ.Publish |
| 129 | +dotnet run --delayed |
| 130 | +``` |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +### Durable + failover |
| 135 | + |
| 136 | +```powershell |
| 137 | +cd samples/Foundatio.RabbitMQ.Subscribe |
| 138 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672,localhost:5673,localhost:5674" --durable |
| 139 | +``` |
| 140 | + |
| 141 | +```powershell |
| 142 | +cd samples/Foundatio.RabbitMQ.Publish |
| 143 | +dotnet run --connection-string "amqp://guest:guest@localhost:5672,localhost:5673,localhost:5674" --durable |
| 144 | +``` |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## Chaos Commands |
| 149 | + |
| 150 | +Run these while your apps are connected: |
| 151 | + |
| 152 | +```powershell |
| 153 | +./scripts/FillDisk.ps1 |
| 154 | +``` |
| 155 | + |
| 156 | +```powershell |
| 157 | +./scripts/ClearDisk.ps1 |
| 158 | +``` |
| 159 | + |
| 160 | +```powershell |
| 161 | +./scripts/KillNode.ps1 |
| 162 | +``` |
| 163 | + |
| 164 | +```powershell |
| 165 | +./scripts/KillNode.ps1 1 -Restart |
| 166 | +``` |
| 167 | + |
| 168 | +```powershell |
| 169 | +./scripts/KillNode.ps1 1 |
| 170 | +./scripts/KillNode.ps1 2 |
| 171 | +``` |
| 172 | + |
| 173 | +```powershell |
| 174 | +./scripts/FillDisk.ps1 1 |
| 175 | +./scripts/FillDisk.ps1 2 |
| 176 | +./scripts/FillDisk.ps1 3 |
| 177 | +``` |
| 178 | + |
| 179 | +```powershell |
| 180 | +./scripts/Status.ps1 |
| 181 | +``` |
0 commit comments