CP_AUTOMATION/scripts/run_300_students_load_test.sh
2025-12-16 13:04:32 +05:30

87 lines
3.6 KiB
Bash
Executable File

#!/bin/bash
# Multi-PC Load Test Script - 300 Students Simultaneously
#
# This script provides commands for 3 PCs to test backend capacity
# Each PC runs 100 students simultaneously
# Total: 300 concurrent students hitting the backend
#
# Usage:
# PC 1: Run the command for PC 1
# PC 2: Run the command for PC 2
# PC 3: Run the command for PC 3
# All at the same time to test 300 concurrent users
echo "=================================================================================="
echo "🚀 MULTI-PC LOAD TEST - 300 STUDENTS SIMULTANEOUSLY"
echo "=================================================================================="
echo ""
echo "📋 INSTRUCTIONS:"
echo " 1. Copy the command for your PC (PC 1, PC 2, or PC 3)"
echo " 2. Run it on your respective machine"
echo " 3. Start all 3 commands at the SAME TIME (coordinate via chat/phone)"
echo " 4. This will test backend capacity for 300 concurrent users"
echo ""
echo "=================================================================================="
echo ""
# Configuration
WORKERS_PER_PC=30 # 30 concurrent browsers per PC (adjust based on PC specs)
METRICS_INTERVAL=10
echo "📊 CONFIGURATION:"
echo " Workers per PC: $WORKERS_PER_PC"
echo " Total concurrent browsers: $((WORKERS_PER_PC * 3))"
echo " Total students: 300 (100 per PC)"
echo " Metrics interval: Every $METRICS_INTERVAL students"
echo ""
echo "=================================================================================="
echo ""
echo "🖥️ PC 1 COMMAND (First CSV - 100 students):"
echo "----------------------------------------------------------------------"
echo "cd /home/tech4biz/work/CP_Front_Automation_Test && source venv/bin/activate && \\"
echo "python3 tests/load_tests/test_generic_load_assessments.py \\"
echo " --csv students_with_passwords_2025-12-15T10-49-08_01.csv \\"
echo " --start 0 --end 100 \\"
echo " --workers $WORKERS_PER_PC \\"
echo " --headless \\"
echo " --metrics-interval $METRICS_INTERVAL"
echo ""
echo "=================================================================================="
echo ""
echo "🖥️ PC 2 COMMAND (Second CSV - 100 students):"
echo "----------------------------------------------------------------------"
echo "cd /home/tech4biz/work/CP_Front_Automation_Test && source venv/bin/activate && \\"
echo "python3 tests/load_tests/test_generic_load_assessments.py \\"
echo " --csv students_with_passwords_2025-12-15T10-59-02_03.csv \\"
echo " --start 0 --end 100 \\"
echo " --workers $WORKERS_PER_PC \\"
echo " --headless \\"
echo " --metrics-interval $METRICS_INTERVAL"
echo ""
echo "=================================================================================="
echo ""
echo "🖥️ PC 3 COMMAND (Third CSV - 100 students):"
echo "----------------------------------------------------------------------"
echo "cd /home/tech4biz/work/CP_Front_Automation_Test && source venv/bin/activate && \\"
echo "python3 tests/load_tests/test_generic_load_assessments.py \\"
echo " --csv students_with_passwords_2025-12-15T11-06-37_05.csv \\"
echo " --start 0 --end 100 \\"
echo " --workers $WORKERS_PER_PC \\"
echo " --headless \\"
echo " --metrics-interval $METRICS_INTERVAL"
echo ""
echo "=================================================================================="
echo ""
echo "💡 TIPS:"
echo " - If PC crashes, reduce --workers to 20 or 15"
echo " - Monitor system resources: htop, free -h"
echo " - Results saved in: reports/load_tests/"
echo " - Check backend logs for API performance"
echo ""
echo "=================================================================================="