How can I improve performance with the Linux 2.6 kernel

General performance tuning tips:

-9550SX(U)/9590SE/9650SA/9690SA – Set Storsave profile to Balance (if you are using a BBU) or Performance (if you don’t have a BBU) -Make sure cache is enabled.  Data loss is possible if you aren’t using a BBU, so be sure to read the 3ware User’s Guide. -Check your NCQ setting.  In general enabling NCQ if your disk drives support NCQ will increase performance.  It is possible that disabling NCQ can increase performance.  It is best to try both NCQ enabled and disabled and measure performance to see which is higher performing for your particular application/disk drive manufacturer/model/firmware. -Make sure your unit is in optimal mode, and not degraded/initializing/verifying.

For Linux kernel 2.6, If you enter the following command:
blockdev –getra /dev/sda

it will list the current read ahead cache settings for block device sda.

If you enter the command:

blockdev –setra X /dev/sda

i.e.

it will set the read ahead cache to 16384.  (Note: 16384 is just an example value.  You will have to do testing to determine the optimal value for your system).  The OS will read-ahead X pages, and throughput will be higher.

To make the change available every time you boot, you can add the ‘blockdev –setra 16384 /dev/sda’, ‘blockdev –setra 16384 /dev/sdb’, ‘blockdev –setra 16384 /dev/sdc’, etc. to /etc/rc.d/rc.local .

You can also put a setting in /etc/sysctl.conf which will set the read-ahead on boot: /sys/bus/scsi/drivers/sd/[DEVICEID]/block/queue/read_ahead_kb

The following parameter is used to enhance the 3ware 9500S and 9550SX/9590SE/9650SE’s (with code sets older than 9.4.1) sequential write performance with Linux kernel 2.6.

 

When using RAID 5 or RAID 6 arrays, limiting the maximum sectors per IO to 64k allows the IO pattern to interact better with the 3ware cache algorithm during sequential writes. Enter the following command to limit the max sectors per transfer to 64k (modifying the device, /dev/sda, as appropriate):

 

echo “64” > /sys/block/sda/queue/max_sectors_kb

 

Note: You must re-apply any read-ahead settings (from a command such as blockdev

–setra 16384 /dev/sda) after applying the above setting.

 

 

The following parameter is also used to enhance the 3ware 9500S and 9550SX/9590SE/9650SE’s sequential write performance with Linux kernel 2.6.

 

When doing heavy I/O to a Linux block device with a large queue depth (such as a 3ware array), the Linux 2.6 kernel has some congestion control algorithm shortcomings. Enter the following command to work around the issue and provide increased write throughput (modifying the device, /dev/sda, as appropriate):

 

echo “512” > /sys/block/sda/queue/nr_requests

 

 

The following parameter increases the 3ware 9500S and 9550SX/9590SE/9650SE’s performance with Linux kernel 2.6 by selecting the ‘deadline’ I/O scheduler.

 

Sequential I/O results can be slightly increased by changing the default I/O scheduler to be the ‘deadline’ I/O scheduler. Enter the following command to select the deadline

I/O scheduler (modifying the device, /dev/sda as appropriate):

 

echo “deadline” > /sys/block/sda/queue/scheduler

 

OR

 

Kernel command line addition: elevator=deadline

 

There are two variables which control the behaviour of VM flushing and allocation and affect network and disk performance and system stability:

vm.dirty_background_ratio and vm.dirty_ratio

 

The defaults for 2.6.9 stock kernels is background ratio 10% and dirty_ratio 40%.  Other kernels have different default values.  Tuning the settings for background ratio to 20% (allowing smaller io to happen mostly in memory until bigger chunks can be written out to the disk) and setting the dirty_ratio to 60% may help in some systems with heavy I/O.  You can experiment with these values until you optimize performance for your environment.

 

To set these values: e.g.

echo 20 > /proc/sys/vm/dirty_background_ratio echo 60 > /proc/sys/vm/dirty_ratio

to make it permanent

edit /etc/sysctl.conf:

vm.dirty_background_ratio = 20 vm.dirty_ratio = 60

blockdev –setra 16384 /dev/sda

发表评论