Wednesday, July 15, 2015

Technic to monitor Apache server performance

iftop tool installation

Enter the command below

# wget http://pkgs.repoforge.org/iftop/iftop-0.17-1.el6.rf.x86_64.rpm
# rpm -ivh iftop-0.17-1.el6.rf.x86_64.rpm

Run the "iftop" command to launch the tool to monitor the network card

Check the number of CPU

Enter the command below

# nproc

nmon tool installation

Enter the command below

# wget http://nmon.sourceforge.net/docs/MPG_nmon_for_Linux_14a_binaries.zip
# unzip MPG_nmon_for_Linux_14a_binaries.zip
# ./nmon_x86_64_centos5

Scripts to check Apache connection

Came across the script below from internet and found out it is helpful to monitor the number of concurrent connection to Apache server. Just show it for sharing purpose

#!/bin/bash

[ $# -eq 0 ] && { echo "Usage: $0 " ; exit 1; }

while true
do
        clear;
        echo "Number of Apache Active Connections:";
        netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | wc -l;
        echo;
        #echo "Current Active IP's:";
        netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort;
        sleep $1;
done

Simple Shell scripts to load test the Apache server

The scripts download sample.pdf from Apache to time the download time and produce CSV report.

#!/bin/bash

for ((i=1; i <= 200 ; i++))
do
    curl -s -w "iPad($i)",%{time_connect},%{time_starttransfer},%{time_total}\\n  -o "sample$i.pdf" https://[SERVER_NAME]/sample.pdf >> report.csv &
done