just put something what I need. Forgive my poor English!

2009年1月26日 星期一

[轉貼] HOWTO : Performance tuning

來源網址:http://samiux.wordpress.com/2008/06/12/performance-tunning/

來源:Samiux’s Blog

-------------------------------------------------------------------

Ubuntu is fast out of the box. However, we can make it more faster.

Step 1 :
Add the following lines to /etc/sysctl.conf if you have 512MB RAM or more :

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 = 256000
# If you have 512MB RAM or less, use this setting
fs.file-max = 65535
vm.swappiness = 1
vm.vfs_cache_pressure = 50

Step 2 :
If you have a fast broadband (UL 10Mbps / DL 10Mbps, my broadband connection speed) (other connection speed is not tested), use the following setting :

net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_no_metrics_save = 1

If you have a Wifi (such as IEEE 802.11 a/b/g) or a 3.5G modem, use the following setting :

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1

Then make the setting effective :

sudo /sbin/sysctl -p

Step 3 :
Tuning for the large hard drive :
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

Reboot your system.

Step 4 (Optional) :
If you are using ext3 as your filesystem, you may consider to add “noatime” to the /etc/fstab for every entry of partitions or hard drives before “relatime“. However, you should pay more attention to this hacking as it is danger. You may not boot up you computer then.

UUID=0e57987f-...... / ext3 noatime,relatime,errors=remount-ro 0 1

After saved the file, you can execute the following command to make sure all entries are okay. If there is any error, go to /etc/fstab to make correction until no error to show up. If there is no error, you can boot your computer if you want.

sudo mount -a

Lightening Ubuntu!!!!

沒有留言:

張貼留言