Files
techircd/STRESS_TEST_README.md

128 lines
3.8 KiB
Markdown

# TechIRCd Stress Testing Tool
A comprehensive Python-based stress testing tool for TechIRCd IRC server.
## Features
- **Configurable Test Scenarios**: JSON-based configuration
- **Multiple Test Types**: Connection tests, message flooding, command spam
- **Gradual or Mass Operations**: Connect/disconnect clients gradually or all at once
- **Real-time Statistics**: Connection counts, message statistics, error tracking
- **Logging**: Detailed logging to file and console
- **SSL Support**: Test both plain and SSL connections
## Requirements
```bash
pip3 install asyncio # Usually included with Python 3.7+
```
## Usage
### Run All Test Scenarios
```bash
python3 stress_test.py
```
### Run Specific Scenario
```bash
python3 stress_test.py --scenario "Basic Connection Test"
```
### Use Custom Configuration
```bash
python3 stress_test.py --config my_config.json
```
## Configuration
Edit `stress_config.json` to customize tests:
### Server Settings
```json
{
"server": {
"host": "localhost", // IRC server hostname
"port": 6667, // IRC server port
"ssl": false, // Use SSL connection
"ssl_port": 6697, // SSL port
"nick_prefix": "StressBot", // Prefix for bot nicknames
"auto_join_channels": ["#test"] // Channels to auto-join
}
}
```
### Test Scenarios
Each scenario supports:
- `client_count`: Number of concurrent clients
- `duration`: How long to run the test (seconds)
- `connect_gradually`: Connect clients one by one vs all at once
- `connect_delay`: Delay between gradual connections
- `disconnect_gradually`: Disconnect gradually vs all at once
- `activities`: List of activities to perform during test
### Activity Types
1. **channel_flood**: Flood channels with messages
2. **private_flood**: Send private messages between clients
3. **join_part_spam**: Rapid JOIN/PART operations
4. **nick_change_spam**: Rapid nickname changes
5. **random_commands**: Send random IRC commands
## Pre-configured Test Scenarios
1. **Basic Connection Test** (10 clients, 30s)
- Simple connection and registration test
2. **Mass Connection Stress** (50 clients, 60s)
- Many simultaneous connections with channel flooding
3. **Gradual Connection Test** (30 clients, 45s)
- Gradual connection buildup with private messaging
4. **Heavy Activity Test** (25 clients, 90s)
- Multiple activity types running simultaneously
5. **Nick Change Spam** (15 clients, 30s)
- Rapid nickname change testing
6. **Channel Chaos Test** (20 clients, 60s)
- JOIN/PART spam with message flooding
7. **Maximum Load Test** (100 clients, 120s)
- Push server to maximum capacity
## Monitoring
- **Real-time logs**: Monitor progress in console
- **Log file**: Detailed logs saved to `stress_test.log`
- **Statistics**: Connection counts, message statistics, error tracking
## Example Output
```
2025-09-07 12:00:00 - INFO - Starting scenario: Basic Connection Test
2025-09-07 12:00:00 - INFO - Clients: 10, Duration: 30s
2025-09-07 12:00:00 - INFO - Mass connecting 10 clients...
2025-09-07 12:00:01 - INFO - Connected 10/10 clients
2025-09-07 12:00:03 - INFO - Registered 10/10 clients
2025-09-07 12:00:33 - INFO - Stats: 10 connected, 10 registered, 0 messages sent
2025-09-07 12:00:35 - INFO - Scenario Basic Connection Test completed
```
## Tips for Testing
1. **Start Small**: Begin with basic connection test
2. **Monitor Resources**: Watch TechIRCd memory/CPU usage
3. **Check Logs**: Review both stress test and TechIRCd logs
4. **Gradual Increase**: Increase client counts gradually
5. **Test Different Scenarios**: Each scenario tests different aspects
## Troubleshooting
- **Connection Refused**: Make sure TechIRCd is running
- **SSL Errors**: Check SSL configuration in both TechIRCd and test config
- **Memory Issues**: Reduce client count or test duration
- **Python Errors**: Ensure Python 3.7+ with asyncio support