Manage Apache Resources Dengan mod_slotlimit

By | October 9, 2008

Satu server Sering di pake bareng-bareng beberapa site, kita perlu mengatur resources yang dipake untuk tiap virtual host biar ngak saling berebut 🙂

mod_slotlimit adalah Apache module yang menggunakan dynamic slot allocation algorithm dan static rules, mampu memanage resources yang digunakan oleh setiap virtual host yang running.

1. Installation
Asumsi disini Apache sudah terinstall dengan DSO yang sudah aktif.
Kemudian download modul mod-slotlimit dan lakukan perintah berikut :

wget http://kent.dl.sourceforge.net/sourceforge/mod-slotlimit/mod_slotlimit.tar.gz
tar zxvf mod_slotlimit.tar.gz
cd mod_slotlimit-1.0
make
make install


Kemudian tambahkan baris berikut di konfigurasi Apache (httpd.conf)

[…]
LoadModule slotlimit_module   /usr/lib/apache2/modules/mod_slotlimit.so (path tergantung OS yang di pake)

2. Configuration

Menurut Documentasi yang ada options yang bisa digunakan :
AvailableSlotsPercent – Percentage of apache slots available in order to activate dynamic slot allocation algorithm
MaxConnectionsPerSite – Max connections for each running site
LimitSite – Specific site to limit
LimitSiteConnections – Max connections for “LimitSite”
ClientIpLimit – Number of maximum simultaneous connection per IP
ForceVhostName – Force vhost hostname in scoreboard. Useful when vhost hostname do not match site visited, for example if you’re using mod_vhost_alias

Sekarang kita tambahkan konfigurasi untuk mod-slotlimit di httpd.conf :

[…]
<IfModule mod_slotlimit.c>
AvailableSlotsPercent 15
MaxConnectionsPerSite 30
LimitSite www.BadSite.xxx
LimitSiteConnections 15
ClientIpLimit 15
ForceVhostName On
</IfModule>
[…]

Jangan lupa restart Apache:
/etc/init.d/apache2 restart

udah deh selamat mencoba 😀