Thursday, March 27, 2014

Install and configure mod_qos with apache - Limit the number of concurrent requests using apache

Description:

In computer networking, the term quality of service (QoS) describes resource management rather than the quality of a service. Quality of service implements control mechanisms to provide different priority to different users, applications, and data connections. It is used to guarantee a certain level of performance to data resources. The term quality of service is often used in the field of wide area network protocols (e.g. ATM) and telephony (e.g. VoIP), but rarely in conjunction with web applications. mod_qos is a quality of service module for the Apache web server implementing control mechanisms that can provide different levels of priority to different HTTP requests.

Installation and Configuration:

Installation and configuration of mod_qos requires Openssl.

The steps to install PCRE,APR,APR-UTIL and Openssl are included as well.

Apache version : 2.2.24, Mod_qos version: 10.29

export  PATH=/usr/ccs/bin:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/sfw/sbin:
export LD_LIBRARY_PATH=/usr/lib:/usr/sfw/lib
export LD_LIBRARY_PATH_64=/usr/lib/64:/usr/sfw/lib/64

For 64 bit installation:

export CC=gcc
export CFLAGS=-m64 -O3
export CPP_FLAGS=-m64 -O3

PCRE Installation: 

cd /softwares/pcre
./configure --disable-cpp CFLAGS="-g -O3" CC="gcc -m64" --prefix=/apache/pcre
gmake clean
gmake
gmake install

Openssl Installation:

cd /softwares/openssl-1.0.1f
./config --prefix=/apache/openssl-1.0.1f thread shared solaris64-gcc -m32
gmake clean
gmake
gmake install

APR Installation:

cd /softwares/apr
./configure --prefix=/apache/apr-1.4.6 --with-gnu-ld --enable-threads
gmake clean
gmake
gmake install

APR-UTIL Installation:

cd /softwares/apr-util
./configure --prefix=/apache/apr-util-1.4.1 --with-openssl=/apache/openssl-1.0.1f --with-apr=/apache/apr-1.4.6 --with-crypto --enable-threads
gmake clean
gmake
gmake install 

Apache & Mod_qos Installation:    


tar -xfz httpd-2.2.24.tar.gz 
tar xfz mod_qos-10.29-src.tar.gz
ln -s httpd-2.2.24 httpd
cd httpd
mkdir modules/qos 

cp ../mod_qos-10.29/apache2/* modules/qos

./buildconf - You have to install libtool,m4 and autoconf utilities and provide their path in PATH variable.

cd /httpd

./configure --prefix=/apache --enable-so  --enable-module=all --enable-mods-shared=all --enable-proxy --enable-ssl --with-ssl=/apache/openssl-1.0.1f --enable-vhost --with-mpm=worker --enable-qos=shared --enable-unique-id --with-pcre=/apache/pcre --with-apr=/apache/apr-1.4.6 --with-apr-util=/apache/apr-util-1.4.1 

Incase, If the apache is already installed use the following command from qos directory of src in apache.

./configure --with-apache=/apache_path  --with-mpm=worker --enable-qos=shared --enable-unique-id --with-pcre=/apache/pcre --with-apr=/apache/apr-1.4.6 --with-apr-util=/apache/apr-util-1.4.1 --with-openssl=/apache/openssl

gmake clean

gmake

gmake install
 

Mod_qos Configuration:

After running the make install, The mod_qos.so module will the be automatically configured in the Apache configuration using the following directive.(httpd.conf)

LoadModule qos_module modules/mod_qos.so

Depending on the requirement,The parameters can be edited.

QS_ClientEventLimitCount 5 1
QS_SrvMaxConnPerIP 5
QS_Limit_Clear
QS_ErrorResponseCode 505

                                                                         (: Happy learning :)

0 comments:

Post a Comment