Step 1:
To control the bandwidth and allow faster cgi browsing, you should install the following modules.
sudo apt-get install libapache2-mod-bw libapache2-mod-fastcgi
Step 2 :
sudo a2enmod deflate
sudo nano /etc/apache2/conf.d/deflate.conf
Add the following lines at the file.
DeflateCompressionLevel 6
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/postscript
Header append Vary User-Agent
sudo /etc/init.d/apache2 restart
Step 3 :
wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xvf eaccelerator-0.9.5.3.tar.bz2
sudo apt-get install build-essential php5-dev
cd eaccelerator-0.9.5.3
phpize
./configure
make
sudo make install
sudo mkdir /tmp/eaccelerator
sudo chmod 0777 /tmp/eaccelerator
Step 4 :
sudo nano /etc/php5/apache2/php.ini
Append the following lines at the end of the file.
extension="eaccelerator.so"
; shm_size default is 16, you may change to 64 or 128 depends on your RAM
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
sudo /etc/init.d/apache2 restart
Performance tuning of Ubuntu 9.04 Server
Step 5 :
sudo nano /etc/sysctl.conf
Append the following lines at the end of the file.
kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# If you have more than 512MB RAM, use this setting (uncomment it and comment the setting just below)
#fs.file-max = 262140
# If you have 512MB RAM or less, use this setting
fs.file-max = 65535
vm.swappiness = 1
vm.vfs_cache_pressure = 50
vm.min_free_kbytes = 65536
net.core.rmem_default = 33554432
net.core.rmem_max = 33554432
net.core.wmem_default = 33554432
net.core.wmem_max = 33554432
net.ipv4.tcp_rmem = 10240 87380 33554432
net.ipv4.tcp_wmem = 10240 87380 33554432
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.core.netdev_max_backlog = 5000
net.ipv4.tcp_mem = 786432 1048576 26777216
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_max_tw_buckets = 360000
sudo /sbin/sysctl -p
Step 6 :
sudo nano /etc/rc.local
Add the following lines before "exit 0".
echo 1024 > /sys/block/sda/queue/read_ahead_kb
echo 256 > /sys/block/sda/queue/nr_requests
*The captioned lines are for sda only.
Step 7 :
sudo nano /etc/fstab
Add "noatime" before "relatime". For example :
UUID=0e57987f-...... / ext3 noatime,relatime,errors=remount-ro 0 1
or
UUID=0e57987f-...... / ext4 noatime,relatime,errors=remount-ro 0 1
sudo mount -a
If there is no error message, you can now reboot your system.
That's all. See you!
No comments:
Post a Comment