Optimizing Linux Performance: Tips and Tricks for a Faster Linux OS

Optimizing Linux Performance: Tips and Tricks for a Faster Linux OS
Page content

Here are four tips that can help you get the best out of your system!

Eliminate Wait Time at Boot-up

The Linux system is configured to wait for a certain number of seconds ranging from 3 to 30 seconds during boot-up process to enable users to select an operating system. However, if you use only Linux operating system, then you bypass the timeout countdown before Linux boots up saving precious seconds. Follow these steps assuming current timeout countdown is 10 seconds.

  • Opening /boot/grub/menu.lst (or /boot/grub/grub.conf) in a text editor with root permissions
  • Locate the line “timeout=10
  • Modify line “timeout=10” to “timeout=0
  • Save and exit text editor
  • Reboot

Presto, you Linux boots a little faster than before.

Get the Best out of your Hard Disk

If you have a DMA [Direct Memory Access] compatible Disk, you can increase data throughput manifold with a small tweak. Increase of data throughput automatically translates into faster boot times improving startup times and overall performance since read times will be of shorter duration whenever your hard disk is accessed. Follow these steps:-

  • Install hdparm through package manager
  • Fireup a root terminal
  • Type hdparm –d1 /dev/had1 and replace /dev/had1 with the path of your boot partition
  • Gnome users: Head to System > Administration > Services. Use gksudo to add the line as an entry at the start enabling it to run with root permissions and no additional authentication. It will run automatically at each startup.

Try Parallel Thinking

By default, processes run sequentially. However, parallelism runs multiple processes simultaneously taking lesser time. Users can take advantage of this in Grub.

  • Fire up /etc/init.d/rc in a text editor with root permissions
  • Locate the line that says CONCURRENCY=none
  • Replace “none” with “shell
  • Save and exit text editor
  • Reboot

If all goes well, you should notice decrease in boot times [a few seconds]. If you are using solo processor [and not multi-core processors], then it may not work. Instead, there may be an increase in boot time.

Milk the Memory

The Linux kernel usually uses swap space or swap partition where it caches data to virtual memory. This is swapped into RAM as and when required. In fact, a similar process is applied to store machine state when system is in hibernation.

However, if your system has lots of memory, then you can take advantage by reducing “swappiness” giving your system a performance boost. Simply put, your kernel caches data in memory more than it does in swap space for quicker access.

  • Open /etc/sysctl.conf in a text editor with root permissions
  • Append the line “vm.swappiness=10” to bottom of file
  • Save and exit text editor
  • Restart session for changes to take effect

The value can be tweaked based on performance in real-time. By lowering value, you use more RAM and less swap space. Some experimentation may be required to get the right values.

As all of us know, Linux is incredibly customizable. The common thread of the four tweaks discussed here is that they speed up your Linux system whether it is decreasing boot time, taking advantage of DMA compatible hard drive, running processes in parallel or optimizing memory through “swappiness”. However, if you are new user, please tread with caution.