Difference between revisions of "Centos-optimization"

From Bashlinux
Jump to: navigation, search
Line 1: Line 1:
  +
__NOTITLE__
 
__NOTOC__
 
__NOTOC__
 
= CentOS Optimizations =
 
= CentOS Optimizations =
Line 4: Line 5:
 
In order to speedup the disk management, some values are added to each `ext3` partition on the terminal.
 
In order to speedup the disk management, some values are added to each `ext3` partition on the terminal.
 
The reference site is located at [[http://wiki.centos.org/HowTos/Disk_Optimization]]
 
The reference site is located at [[http://wiki.centos.org/HowTos/Disk_Optimization]]
 
<pre><nowiki>
 
 
LABEL=/ / ext3 defaults,noatime,data=writeback,commit=120 1 1
 
LABEL=/ / ext3 defaults,noatime,data=writeback,commit=120 1 1
 
tmpfs /dev/shm tmpfs defaults 0 0
 
tmpfs /dev/shm tmpfs defaults 0 0
Line 12: Line 11:
 
proc /proc proc defaults 0 0
 
proc /proc proc defaults 0 0
 
/customswap swap swap defaults 0 0
 
/customswap swap swap defaults 0 0
</nowiki></pre>
 
 
   
 
==== noatime ====
 
==== noatime ====
Line 20: Line 17:
 
==== data=writeback ====
 
==== data=writeback ====
 
The data order is not preserved when writes to disk. Just after set this value and before restart the terminal run the following command to avoid goes into read-only mode.
 
The data order is not preserved when writes to disk. Just after set this value and before restart the terminal run the following command to avoid goes into read-only mode.
 
<pre><nowiki>
 
 
tune2fs -o +journal_data_writeback /dev/hda1
 
tune2fs -o +journal_data_writeback /dev/hda1
</nowiki></pre>
 
 
   
 
==== commit=120 ====
 
==== commit=120 ====
Line 31: Line 24:
 
== Solid State Disk ==
 
== Solid State Disk ==
 
Usually the IDE SSD are slower that the SATA SSD, and some times could even be slower than the regular IDE. To speed up a bit, we can apply the changes mentioned above, but also scheduler can be changed in the following way:
 
Usually the IDE SSD are slower that the SATA SSD, and some times could even be slower than the regular IDE. To speed up a bit, we can apply the changes mentioned above, but also scheduler can be changed in the following way:
 
 
<pre><nowiki>
 
 
# echo deadline > /sys/block/sda/queue/scheduler
 
# echo deadline > /sys/block/sda/queue/scheduler
 
# echo 1 > /sys/block/sda/queue/iosched/fifo_batch
 
# echo 1 > /sys/block/sda/queue/iosched/fifo_batch
</nowiki></pre>
 
 
   
 
All the other options for the scheduler can be displayed with the command
 
All the other options for the scheduler can be displayed with the command
 
<pre><nowiki>
 
 
# cat /sys/block/sda/queue/scheduler
 
# cat /sys/block/sda/queue/scheduler
</nowiki></pre>
 
   
but usually `noop` and `deadline` are the 2 that works well with SDD.
+
but usually <code>noop</code> and <code>deadline</code> are the 2 that works well with SDD.
   
To make permanent this change, add the `elevator=deadline ` at the end of the kernel line in /boot/menu/grub.conf
+
To make permanent this change, add the <code>elevator=deadline</code> at the end of the kernel line in <tt>/boot/menu/grub.conf</tt>
   
 
== System ==
 
== System ==
In `/etc/sysctl.conf` set the vualue
+
In <tt>/etc/sysctl.conf</tt> set the vualue
 
<pre><nowiki>
 
 
kernel.shmmax = 63554432
 
kernel.shmmax = 63554432
</nowiki></pre>
 
   
 
to increase ''Maximum shared segment''.
 
to increase ''Maximum shared segment''.
Line 60: Line 42:
 
== Boot ==
 
== Boot ==
 
Reduce boot time passing the known values to the kernel, the site that references.
 
Reduce boot time passing the known values to the kernel, the site that references.
Optimizations can be found at [[[Media:centos-optimization$embedded_linux_optimizations.pdf|Embedded|Linux Optimizations]]]
+
Optimizations can be found at [[[Media:centos-optimization$embedded_linux_optimizations.pdf | Free Electrons - Embedded Linux Optimizations]]]
 
<pre><nowiki>
 
 
# grub.conf generated by anaconda
 
# grub.conf generated by anaconda
 
#
 
#
Line 81: Line 61:
 
kernel /boot/vmlinuz-2.6.18-53.el5 ro root=LABEL=/ rhgb vga=792 lpj=998235 reboot=soft quiet
 
kernel /boot/vmlinuz-2.6.18-53.el5 ro root=LABEL=/ rhgb vga=792 lpj=998235 reboot=soft quiet
 
initrd /boot/initrd-2.6.18-53.el5.img
 
initrd /boot/initrd-2.6.18-53.el5.img
</nowiki></pre>
 
 
   
 
==== lpj ====
 
==== lpj ====
Loops per jiffy can be obtained from `/var/log/messages`
+
Loops per jiffy can be obtained from <tt>/var/log/messages</tt>
   
 
==== reboot=soft ====
 
==== reboot=soft ====
Line 91: Line 69:
   
 
==== quiet ====
 
==== quiet ====
Doesn't log all the boot messages to the `stdout`
+
Doesn't log all the boot messages to the <tt>stdout</tt>

Revision as of 01:55, 6 June 2015

__NOTITLE__

CentOS Optimizations

Disk

In order to speedup the disk management, some values are added to each `ext3` partition on the terminal. The reference site is located at [[1]]

LABEL=/                 /                       ext3    defaults,noatime,data=writeback,commit=120        1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/customswap swap swap defaults 0 0

noatime

Don't write access time

data=writeback

The data order is not preserved when writes to disk. Just after set this value and before restart the terminal run the following command to avoid goes into read-only mode.

tune2fs -o +journal_data_writeback /dev/hda1

commit=120

Set the time to sync data and metadata.

Solid State Disk

Usually the IDE SSD are slower that the SATA SSD, and some times could even be slower than the regular IDE. To speed up a bit, we can apply the changes mentioned above, but also scheduler can be changed in the following way:

# echo deadline > /sys/block/sda/queue/scheduler
# echo 1 > /sys/block/sda/queue/iosched/fifo_batch

All the other options for the scheduler can be displayed with the command

# cat /sys/block/sda/queue/scheduler

but usually noop and deadline are the 2 that works well with SDD.

To make permanent this change, add the elevator=deadline at the end of the kernel line in /boot/menu/grub.conf

System

In /etc/sysctl.conf set the vualue

kernel.shmmax = 63554432

to increase Maximum shared segment.

Boot

Reduce boot time passing the known values to the kernel, the site that references. Optimizations can be found at [[[Media:centos-optimization$embedded_linux_optimizations.pdf | Free Electrons - Embedded Linux Optimizations]]]

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/hda1
#          initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=0
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
password --md5 $1$/omJBwhD$phlKUXHDZI6BMLkNSfNgD/
title Bashlinux 
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18-53.el5 ro root=LABEL=/ rhgb vga=792 lpj=998235 reboot=soft quiet
    initrd /boot/initrd-2.6.18-53.el5.img

lpj

Loops per jiffy can be obtained from /var/log/messages

reboot=soft

When reboots, the firmware will be skipped.

quiet

Doesn't log all the boot messages to the stdout