HOWTO : Performance tuning

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 :

net.core.rmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_default = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 10240 87380 16777216
net.ipv4.tcp_wmem = 10240 87380 16777216
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

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!!!!

Advertisements

4 Responses

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: