203 lines
5.5 KiB
Markdown
203 lines
5.5 KiB
Markdown
# 🚀 Multi-PC Load Test - 300 Students Simultaneously
|
||
|
||
## Overview
|
||
|
||
This guide provides commands for **3 PCs** to test backend capacity by running **300 students simultaneously** (100 per PC).
|
||
|
||
## 📊 Test Configuration
|
||
|
||
- **Total Students**: 300
|
||
- **Students per PC**: 100
|
||
- **Concurrent Browsers per PC**: 30 (adjustable)
|
||
- **Total Concurrent Browsers**: 90 (30 × 3)
|
||
- **Backend Load**: 300 students hitting the server simultaneously
|
||
|
||
## 🖥️ Commands for Each PC
|
||
|
||
### PC 1 - First CSV (100 students)
|
||
|
||
```bash
|
||
cd /home/tech4biz/work/CP_Front_Automation_Test
|
||
source venv/bin/activate
|
||
|
||
python3 tests/load_tests/test_generic_load_assessments.py \
|
||
--csv students_with_passwords_2025-12-15T10-49-08_01.csv \
|
||
--start 0 --end 100 \
|
||
--workers 30 \
|
||
--headless \
|
||
--metrics-interval 10
|
||
```
|
||
|
||
### PC 2 - Second CSV (100 students)
|
||
|
||
```bash
|
||
cd /home/tech4biz/work/CP_Front_Automation_Test
|
||
source venv/bin/activate
|
||
|
||
python3 tests/load_tests/test_generic_load_assessments.py \
|
||
--csv students_with_passwords_2025-12-15T10-59-02_03.csv \
|
||
--start 0 --end 100 \
|
||
--workers 30 \
|
||
--headless \
|
||
--metrics-interval 10
|
||
```
|
||
|
||
### PC 3 - Third CSV (100 students)
|
||
|
||
```bash
|
||
cd /home/tech4biz/work/CP_Front_Automation_Test
|
||
source venv/bin/activate
|
||
|
||
python3 tests/load_tests/test_generic_load_assessments.py \
|
||
--csv students_with_passwords_2025-12-15T11-06-37_05.csv \
|
||
--start 0 --end 100 \
|
||
--workers 30 \
|
||
--headless \
|
||
--metrics-interval 10
|
||
```
|
||
|
||
## ⚡ Execution Steps
|
||
|
||
1. **Prepare all 3 PCs**:
|
||
- Ensure all have the project cloned
|
||
- Ensure all have virtual environment activated
|
||
- Ensure all have dependencies installed
|
||
- Ensure backend is running and accessible
|
||
|
||
2. **Coordinate start time**:
|
||
- Use a countdown (3... 2... 1... GO!)
|
||
- Or use a shared timer
|
||
- **CRITICAL**: All 3 must start at the same time
|
||
|
||
3. **Run commands simultaneously**:
|
||
- PC 1: Run PC 1 command
|
||
- PC 2: Run PC 2 command
|
||
- PC 3: Run PC 3 command
|
||
- All at the exact same time
|
||
|
||
4. **Monitor progress**:
|
||
- Each PC will show real-time metrics
|
||
- Check backend logs for API performance
|
||
- Monitor backend server resources
|
||
|
||
## 🔧 Adjusting Workers (if PC crashes)
|
||
|
||
If a PC crashes or runs out of resources, reduce workers:
|
||
|
||
### Option 1: Reduce to 20 workers per PC
|
||
```bash
|
||
--workers 20 # Instead of 30
|
||
```
|
||
|
||
### Option 2: Reduce to 15 workers per PC
|
||
```bash
|
||
--workers 15 # More conservative
|
||
```
|
||
|
||
### Option 3: Reduce to 10 workers per PC
|
||
```bash
|
||
--workers 10 # Very conservative, but safer
|
||
```
|
||
|
||
**Note**: Lower workers = slower execution, but more stable
|
||
|
||
## 📈 Expected Results
|
||
|
||
### Backend Load
|
||
- **300 students** hitting the backend simultaneously
|
||
- **90 concurrent browsers** (30 per PC)
|
||
- **All students** going through complete flow:
|
||
- Login
|
||
- Password reset (if needed)
|
||
- Profile completion (if needed)
|
||
- Assessment completion
|
||
- Feedback submission
|
||
|
||
### Performance Metrics
|
||
- Each PC will generate a report in `reports/load_tests/`
|
||
- Check backend logs for:
|
||
- API response times
|
||
- Database query performance
|
||
- Server resource usage (CPU, RAM)
|
||
- Error rates
|
||
|
||
## 🎯 Success Criteria
|
||
|
||
### Backend Should Handle:
|
||
- ✅ 300 concurrent logins
|
||
- ✅ 300 concurrent password resets (if needed)
|
||
- ✅ 300 concurrent profile completions (if needed)
|
||
- ✅ 300 concurrent assessment submissions
|
||
- ✅ 300 concurrent feedback submissions
|
||
|
||
### What to Monitor:
|
||
1. **Backend Response Times**: Should stay reasonable (< 5 seconds)
|
||
2. **Error Rates**: Should be minimal (< 5%)
|
||
3. **Server Resources**: CPU/RAM should not max out
|
||
4. **Database Performance**: Queries should complete in time
|
||
5. **API Timeouts**: Should be minimal
|
||
|
||
## 📊 Results Analysis
|
||
|
||
After test completion:
|
||
|
||
1. **Collect reports from all 3 PCs**:
|
||
```bash
|
||
# On each PC, check:
|
||
ls -lh reports/load_tests/load_test_Complete_Assessment_Flow_*users_*.json
|
||
```
|
||
|
||
2. **Check backend logs**:
|
||
- API response times
|
||
- Error logs
|
||
- Database query logs
|
||
- Server resource usage
|
||
|
||
3. **Analyze results**:
|
||
- Success rate across all 300 students
|
||
- Average completion time
|
||
- Error patterns
|
||
- Backend bottlenecks
|
||
|
||
## ⚠️ Troubleshooting
|
||
|
||
### PC Crashes
|
||
- **Symptom**: PC becomes unresponsive
|
||
- **Solution**: Reduce `--workers` to 20 or 15
|
||
|
||
### Backend Timeouts
|
||
- **Symptom**: Many "timeout" errors in results
|
||
- **Solution**: Backend may need scaling or optimization
|
||
|
||
### High Error Rate
|
||
- **Symptom**: > 10% failure rate
|
||
- **Solution**: Check backend logs for root cause
|
||
|
||
### Slow Performance
|
||
- **Symptom**: Tests taking very long (> 2 hours)
|
||
- **Solution**: Normal for 300 students, but check backend performance
|
||
|
||
## 📝 Quick Reference
|
||
|
||
### All 3 Commands (Copy-Paste Ready)
|
||
|
||
**PC 1:**
|
||
```bash
|
||
cd /home/tech4biz/work/CP_Front_Automation_Test && source venv/bin/activate && python3 tests/load_tests/test_generic_load_assessments.py --csv students_with_passwords_2025-12-15T10-49-08_01.csv --start 0 --end 100 --workers 30 --headless --metrics-interval 10
|
||
```
|
||
|
||
**PC 2:**
|
||
```bash
|
||
cd /home/tech4biz/work/CP_Front_Automation_Test && source venv/bin/activate && python3 tests/load_tests/test_generic_load_assessments.py --csv students_with_passwords_2025-12-15T10-59-02_03.csv --start 0 --end 100 --workers 30 --headless --metrics-interval 10
|
||
```
|
||
|
||
**PC 3:**
|
||
```bash
|
||
cd /home/tech4biz/work/CP_Front_Automation_Test && source venv/bin/activate && python3 tests/load_tests/test_generic_load_assessments.py --csv students_with_passwords_2025-12-15T11-06-37_05.csv --start 0 --end 100 --workers 30 --headless --metrics-interval 10
|
||
```
|
||
|
||
---
|
||
|
||
**Ready to test backend capacity for 300 concurrent users!** 🚀
|
||
|