Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, November 1, 2011

hot-to monitor raid status with lsi 9211-4i

In my previous post i told how to monitor raid stutus with lsi 9260-4i with nagios. Now i tell how to monitor raid status with raid controller lsi 9211-4i. This controller doesn't support by MegaCli utility.
The solution is: to use sas2ircu
you can find it there:


http://www.supermicro.com/support/faqs/data_lib/FAQ_9633_SAS2IRCU_Phase_5.0-5.00.00.00.zip

The zip file includes the utility for DOS, Linux PPC, Linux x86 (which will also work on x64), Solaris Sparc and X86, and Windows 32-bit and 64-bit.

i use it with nagios-nrpe server, so i write very-very simple shell script (/usr/local/bin/check_sas2ircu_raid.sh):

#!/bin/sh
exitstatus=2
STATUS=`/usr/local/bin/sas2ircu 0 STATUS |grep "Volume state"`
state=`echo "$STATUS"| awk '{ print $4 }'`
if [ "$state" = "Optimal" ]
then
    exitstatus=0
fi
echo "Volume state: $state"
exit $exitstatus



and now, write in nrpe config (for example, /etc/nagios/nrpe_local.cfg )

command[check_raid]=/usr/bin/sudo /usr/local/bin/check_sas2ircu_raid.sh

and finally, add to sudoers file


nagios ALL= NOPASSWD: /usr/local/bin/check_sas2ircu_raid.sh

now you can check raid status with nagios, simply add new service to nagios host config

how to monitor lsi hardware raid

We have installation of  debian-6 (amd64) on  hardware raid1  with lsi controller 9260-4i. And  we want to monitor raid staus with nagios..

In debian repositories is present package mpt-status, but it can't help in this situation. After installation mpt-status don't work properly.

The solution is to use MegaCli package from lsi.
But it is very hard to find and download this package// avaliable link to download MegaCli is http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip .
Download it .
Unzip file. You will have rpm file. We use Debian, so we need to run (extrat file from rpm)
rpm2cpio MegaCli-8.02.16-1.i386.rpm | cpio -idmv
you will have both executable files: for 32 and 64 - architecture .
The binaries are statically compiled so actually run fine.

you can also need to install libsysfs2 , which is need for MegaCli. And if libsysfs version is difeerent you can create sym link to existing .
In this situation, it simply turned out my drives were setup as RAID 1 mirrors, which was easy to discern using:
./MegaCli64 -CfgDsply -aALL 

Most useful command is:


#Physical Disk List
./MegaCli64 -PDList -aALL

#Physical Drive Info
./MegaCli64 -pdInfo -PhysDrv \[252:4\] -aALL |less

#Logical Disk Info
./MegaCli64 -LDInfo -LAll -aAll | less

# Config Display
./MegaCli64 -CfgDsply -aALL

# Config add Logical Drive
./MegaCli64 -CfgLdAdd -r0 \[252:4,252:5\] -a0

# Logical Drive Init
./MegaCli64 -LDInit -Start -L2 -a0


Monday, October 10, 2011

Changing linux I/O Scheduler on-line



When performance tuning any modern Linux system, selecting a proper I/O scheduler is an important but often under looked optimization. Linux comes configured with the cfq (Completely Fair Queuing) scheduler which has been optimized for best performance over a wide variety of tasks. If you are running specific applications such as mysql or are running on more advanced hardware such as powerful raid controllers or solid state drives, the cfq scheduler may not be providing you the best performance possible.
Linux currently ships with four different I/O schedulers. They are: deadline, noop, anticipatory, and cfq. There are many differences between these scheduling algorithms, here is a brief outline of each:
CFQ: This is the default algorithm in most Linux distributions. It attempts to distribute all I/O bandwidth evenly among all processes requesting I/O. It is ideal for most purposes.
NOOP: The noop algorithm attempts to use as little cpu as possible. It acts as a basic FIFO queue expecting the hardware controller to handle the performance operations of the requests.
Anticipatory: This algorithm attempts to reorder all disk I/O operations to optimize disk seeks. It is designed to increase performance on systems that have slow disks.
Deadline: This scheduling algorithm places I/O requests in a priority queue so each is guaranteed to be ran within a certain time. It is often used in real-time operating systems.
Since the 2.6.10 kernel you were given the option to easily adjust the disk scheduler on the fly without a reboot. You can see which scheduler you are currently running by typing:
1
2
# cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]
In this case sda is the block device in question., here we can see we are currently running the cfq scheduler. You can easily change the scheduler you are using by echoing the scheduler you wish to use into it:
1
# echo noop > /sys/block/sda/queue/scheduler
We now are using the noop scheduler indicated by brackets:
1
2
# cat /sys/block/sda/queue/scheduler
[noop] anticipatory deadline cfq
Changing schedulers on the fly allows you to test and benchmark the algorithms for your specific application .Once the change is issued, any current I/O operations will be executed before the new scheduler goes into effect, so the change will not be instantaneous. Also remember that once one is set and performs to your liking, be sure to set the change to be applied on subsequent reboots.
There are cases where cfq may not be the best scheduler for your system or application. An example is if you are running a raid disk array with a caching raid controller. In this instance many reads and writes will be cached by the disk controller to be executed based on its own scheduling algorithm. Scheduling algorithms such as noop may offer you better performance by not wasting host os cpu cycles reordering I/O operations that do not offer the disk subsystem any benefit. Solid state drives are another case where any algorithm that reorders disk operations may not offer any benefit since random access times are identical to sequential access times. It is often recommend to use noop or deadline on any SSD drive.
There is usually no definitive answer to which algorithm to use, so benchmarking each one will be your best option. Performance results will depend greatly on the applications that are running, the type and speed of hard drives being used, the disk controllers or raid cards / level in use, along with the overall system load and amount of disk I/O. Please also keep in mind that each of these algorithms has many additional configurable options to further tweak performance to your needs depending on how much time you wish to spend on them.


Tuesday, April 12, 2011

обновлення OpenSuse з 11.03 до 11.04

# zypper modifyrepo --all --disable

Сховище «openSUSE113» було успішно вимкнено.
Сховище «openSUSE113_NonFree» було успішно вимкнено.
Сховище «packman» було успішно вимкнено.


# zypper repos --uri

# zypper addrepo --name "openSUSE-11.4 OSS" http://download.opensuse.org/distribution/11.4/repo/oss/ repo-11.4-oss

Додавання сховища "openSUSE-11.4 OSS" [завершено]
Сховище «openSUSE-11.4 OSS» успішно додано
Увімкнено: Так
Автоосвіження: Ні
URI: http://download.opensuse.org/distribution/11.4/repo/oss/

# zypper repos --uri

# | Псевдонім | Назва | Увімкнено | Оновити | URI
--+---------------------+---------------------+-----------+---------+------------------------------------------------------------
1 | openSUSE113 | openSUSE113 | Ні | Ні | http://download.opensuse.org/distribution/11.3/repo/oss
2 | openSUSE113_NonFree | openSUSE113_NonFree | Ні | Ні | http://download.opensuse.org/distribution/11.3/repo/non-oss
3 | packman | packman | Ні | Ні | http://packman.iu-bremen.de/suse/11.3/
4 | repo-11.4-oss | openSUSE-11.4 OSS | Так | Ні | http://download.opensuse.org/distribution/11.4/repo/oss/

# zypper addrepo --name "openSUSE-11.4 Non-OSS" http://download.opensuse.org/distribution/11.4/repo/non-oss/ repo-11.4-non-oss

Додавання сховища "openSUSE-11.4 Non-OSS" [завершено]
Сховище «openSUSE-11.4 Non-OSS» успішно додано
Увімкнено: Так
Автоосвіження: Ні
URI: http://download.opensuse.org/distribution/11.4/repo/non-oss/

# zypper addrepo --name "openSUSE-11.4 Updates" http://download.opensuse.org/update/11.4/ repo-11.4-update

Додавання сховища "openSUSE-11.4 Updates" [завершено]
Сховище «openSUSE-11.4 Updates» успішно додано
Увімкнено: Так
Автоосвіження: Ні
URI: http://download.opensuse.org/update/11.4/

# zypper ref

Звантаження метаданих сховища «openSUSE-11.4 Non-OSS» [завершено]
Створення кешу сховища "openSUSE-11.4 Non-OSS" [завершено]
Звантаження метаданих сховища «openSUSE-11.4 OSS» [завершено]
Створення кешу сховища "openSUSE-11.4 OSS" [завершено]
Звантаження метаданих сховища «openSUSE-11.4 Updates» [завершено]
Створення кешу сховища "openSUSE-11.4 Updates" [завершено]
Всі сховища було освіжено.

# zypper dup

#reboot

Thursday, July 16, 2009

Linux TCP Tuning

Linux TCP Tuning

There are a lot of differences between Linux version 2.4 and 2.6, so first we'll cover the tuning issues that are the same in both 2.4 and 2.6. To change TCP settings in, you add the entries below to the file /etc/sysctl.conf, and then run "sysctl -p". 

Like all operating systems, the default maximum Linux TCP buffer sizes are way too small. I suggest changing them to the following settings: 
  # increase TCP max buffer size setable using setsockopt()
  net.core.rmem_max = 16777216
  net.core.wmem_max = 16777216
  # increase Linux autotuning TCP buffer limits
  # min, default, and max number of bytes to use
  # set max to at least 4MB, or higher if you use very high BDP paths
  net.ipv4.tcp_rmem = 4096 87380 16777216 
  net.ipv4.tcp_wmem = 4096 65536 16777216

You should also verify that the following are all set to the default value of 1 
  sysctl net.ipv4.tcp_window_scaling 
  sysctl net.ipv4.tcp_timestamps 
  sysctl net.ipv4.tcp_sack

Note: you should leave tcp_mem alone. The defaults are fine. 

Another thing you can try that may help increase TCP throughput is to increase the size of the interface queue. To do this, do the following: 
  ifconfig eth0 txqueuelen 1000

I've seen increases in bandwidth of up to 8x by doing this on some long, fast paths. This is only a good idea for Gigabit Ethernet connected hosts, and may have other side effects such as uneven sharing between multiple streams. 

Also, I've been told that for some network paths, using the Linux 'tc' (traffic control) system to pace traffic out of the host can help improve total throughput. 
Linux 2.4 

Starting with Linux 2.4, Linux has implemented a sender-side autotuning mechanism, so that setting the optimal buffer size on the sender is not needed. This assumes you have set large buffers on the receive side, as the sending buffer will not grow beyond the size of the receive buffer. 

However, Linux 2.4 has some other strange behavior that one needs to be aware of. For example: The value for ssthresh for a given path is cached in the routing table. This means that if a connection has has a retransmission and reduces its window, then all connections to that host for the next 10 minutes will use a reduced window size, and not even try to increase its window. The only way to disable this behavior is to do the following before all new connections (you must be root): 
  sysctl -w net.ipv4.route.flush=1

More information on various tuning parameters for Linux 2.4 are available in the Ipsysctl tutorial . 
Linux 2.6 

Starting in Linux 2.6.7 (and back-ported to 2.4.27), linux includes alternative congestion control algorithms beside the traditional 'reno' algorithm. These are designed to recover quickly from packet loss on high-speed WANs. 

Linux 2.6 also includes and both send and receiver-side automatic buffer tuning (up to the maximum sizes specified above). There is also a setting to fix the ssthresh caching weirdness described above. 

There are a couple additional sysctl settings for 2.6: 
  # don't cache ssthresh from previous connection
  net.ipv4.tcp_no_metrics_save = 1
  net.ipv4.tcp_moderate_rcvbuf = 1
  # recommended to increase this for 1000 BT or higher
  net.core.netdev_max_backlog = 2500
  # for 10 GigE, use this
  # net.core.netdev_max_backlog = 30000  

Starting with version 2.6.13, Linux supports pluggable congestion control algorithms . The congestion control algorithm used is set using the sysctl variable net.ipv4.tcp_congestion_control, which is set to cubic or reno by default, depending on which version of the 2.6 kernel you are using. 

To get a list of congestion control algorithms that are available in your kernel, run: 
  sysctl net.ipv4.tcp_available_congestion_control

The choice of congestion control options is selected when you build the kernel. The following are some of the options are available in the 2.6.23 kernel: 
reno: Traditional TCP used by almost all other OSes. (default) 
cubic: CUBIC-TCP (NOTE: There is a cubic bug in the Linux 2.6.18 kernel. Use 2.6.19 or higher!) 
bic: BIC-TCP 
htcp: Hamilton TCP 
vegas: TCP Vegas 
westwood: optimized for lossy networks 

For very long fast paths, I suggest trying cubic or htcp if reno is not is not performing as desired. To set this, do the following: 
 
 sysctl -w net.ipv4.tcp_congestion_control=htcp

More information on each of these algorithms and some results can be found here . 

More information on tuning parameters and defaults for Linux 2.6 are available in the file ip-sysctl.txt, which is part of the 2.6 source distribution. 

Warning on Large MTUs: If you have configured your Linux host to use 9K MTUs, but the connection is using 1500 byte packets, then you actually need 9/1.5 = 6 times more buffer space in order to fill the pipe. In fact some device drivers only allocate memory in power of two sizes, so you may even need 16/1.5 = 11 times more buffer space! 

And finally a warning for both 2.4 and 2.6: for very large BDP paths where the TCP window is > 20 MB, you are likely to hit the Linux SACK implementation problem. If Linux has too many packets in flight when it gets a SACK event, it takes too long to located the SACKed packet, and you get a TCP timeout and CWND goes back to 1 packet. Restricting the TCP buffer size to about 12 MB seems to avoid this problem, but clearly limits your total throughput. Another solution is to disable SACK. 
Linux 2.2 

If you are still running Linux 2.2, upgrade! If this is not possible, add the following to /etc/rc.d/rc.local 
  echo 8388608 > /proc/sys/net/core/wmem_max  
  echo 8388608 > /proc/sys/net/core/rmem_max
  echo 65536 > /proc/sys/net/core/rmem_default
  echo 65536 > /proc/sys/net/core/wmem_default