Friday, 17 June 2016



Spreading logical volumes over multiple disks :

A common issue on AIX servers is, that logical volumes are configured on only one single disk, sometimes causing high disk utilization on a small number of disks in the system, and impacting the performance of the application running on the server.

If you suspect that this might be the case, first try to determine which disks are saturated on the server. Any disk that is in use more than 60% all the time, should be considered. You can use commands such as iostat, sar -d, nmon and topas to determine which disks show high utilization. If the do, check which logical volumes are defined on that disk, for example on an IBM SAN disk:

    # lspv -l hdisk23

A good idea always is to spread the logical volumes on a disk over multiple disk. That way, the logical volume manager will spread the disk I/O over all the disks that are part of the logical volume, utilizing the queue_depth of all disks, greatly improving performance where disk I/O is concerned.

Let's say you have a logical volume called prodlv of 128 LPs, which is sitting on one disk, hdisk408. To see the allocation of the LPs of logical volume prodlv, run:

    # lslv -m prodlv

Let's also assume that you have a large number of disks in the volume group, in which prodlv is configured. Disk I/O usually works best if you have a large number of disks in a volume group. For example, if you need to have 500 GB in a volume group, it is usually a far better idea to assign 10 disks of 50 GB to the volume group, instead of only one disk of 512 GB. That gives you the possibility of spreading the I/O over 10 disks instead of only one.

To spread the disk I/O prodlv over 8 disks instead of just one disk, you can create an extra logical volume copy on these 8 disks, and then later on, when the logical volume is synchronized, remove the original logical volume copy (the one on a single disk hdisk408). So, divide 128 LPs by 8, which gives you 16LPs. You can assign 16 LPs for logical volume prodlv on 8 disks, giving it a total of 128 LPs.

First, check if the upper bound of the logical volume is set ot at least 9. Check this by running:

    # lslv prodlv

The upper bound limit determines on how much disks a logical volume can be created. You'll need the 1 disk, hdisk408, on which the logical volume already is located, plus the 8 other disks, that you're creating a new copy on. Never ever create a copy on the same disk. If that single disk fails, both copies of your logical volume will fail as well. It is usually a good idea to set the upper bound of the logical volume a lot higher, for example to 32:

    # chlv -u 32 prodlv

The next thing you need to determine is, that you actually have 8 disks with at least 16 free LPs in the volume group. You can do this by running:

    # lsvg -p prodvg | sort -nk4 | grep -v hdisk408 | tail -8
    hdisk188  active  959   40  00..00..00..00..40
    hdisk163  active  959   42  00..00..00..00..42
    hdisk208  active  959   96  00..00..96..00..00
    hdisk205  active  959  192  102..00..00..90..00
    hdisk194  active  959  240  00..00..00..48..192
    hdisk24   active  959  243  00..00..00..51..192
    hdisk304  active  959  340  00..89..152..99..00
    hdisk161  active  959  413  14..00..82..125..192

Note how in the command above the original disk, hdisk408, was excluded from the list.

Any of the disks listed, using the command above, should have at least 1/8th of the size of the logical volume free, before you can make a logical volume copy on it for prodlv.

Now create the logical volume copy. The magical option you need to use is "-e x" for the logical volume commands. That will spread the logical volume over all available disks. If you want to make sure that the logical volume is spread over only 8 available disks, and not all the available disks in a volume group, make sure you specify the 8 available disks:

    # mklvcopy -e x prodlv 2 hdisk188 hdisk163 hdisk208 \
    hdisk205 hdisk194 hdisk24 hdisk304 hdisk161

Now check again with "mklv -m prodlv" if the new copy is correctly created:

    # lslv -m prodlv | awk '{print $5}' | grep hdisk | sort -dfu | \
    while read pv ; do
    result=`lspv -l $pv | grep prodlv`
    echo "$pv $result"
    done

The output should similar like this:

    hdisk161 prodlv  16  16  00..00..16..00..00  N/A
    hdisk163 prodlv  16  16  00..00..00..00..16  N/A
    hdisk188 prodlv  16  16  00..00..00..00..16  N/A
    hdisk194 prodlv  16  16  00..00..00..16..00  N/A
    hdisk205 prodlv  16  16  16..00..00..00..00  N/A
    hdisk208 prodlv  16  16  00..00..16..00..00  N/A
    hdisk24  prodlv  16  16  00..00..00..16..00  N/A
    hdisk304 prodlv  16  16  00..16..00..00..00  N/A

Now synchronize the logical volume:

    # syncvg -l prodlv

And remove the original logical volume copy:

    # rmlvcopy prodlv 1 hdisk408

Then check again:

    # lslv -m prodlv

Now, what if you have to extend the logical volume prodlv later on with another 128 LPs, and you still want to maintain the spreading of the LPs over the 8 disks? Again, you can use the "-e x" option when running the logical volume commands:

    # extendlv -e x prodlv 128 hdisk188 hdisk163 hdisk208 \
    hdisk205 hdisk194 hdisk24 hdisk304 hdisk161

You can also use the "-e x" option with the mklv command to create a new logical volume from the start with the correct spreading over disks. 

No comments:

Post a Comment