• No results found

Chapter 1. Components of the logical volume manager

2.2 Concepts

2.2.2 The scheduling policy

If you have multiple copies of a specific logical volume on separate physical disks, how do you decide how an I/O request (for example, read or write system call) is made? On which disk do you write first? When is the request really finished, after the first disk has been written or all of them have? The answer is included in the concept called scheduling policy, and is determined by an attribute of the logical volume. There are two types of scheduling policy,

parallel (the AIX default) and sequential.

In general discussion about the mirroring mechanism, we won’t distinguish between the original copy and its mirrors; that is, the first one and the ones created after from that master. The exception to this is when we discuss the read, write request order in sequential scheduling policy. In sequential scheduling policy, there are distinct primary copy and secondary copies. The default behavior of this scheduling policy is determined by an attribute of the logical volume considered. To check the value of this attribute, you can use the following SMIT dialog:

# smit -C lv

Set Characteristic of a Logical Volume Change a Logical Volume

Choose the appropriate logical volume name as LOGICAL VOLUME name. mirrorvg is the only command providing a real exact mapping function. The -m flag allows you to create the mirror of a volume group that has for every logical volume the same physical partitions.

The scheduling policy is shown in the rectangle in the previous figure.

Otherwise, you can examine this from the command line (the attribute is also shown in the following rectangle):

2.2.2.1 The parallel scheduling policy

The majority of mirrors created on AIX have the parallel scheduling policy (it is the default value for a newly created logical volume). With the parallel scheduling policy, there is no primary or secondary mirror. All copies in a mirror set are just referred to as copy, regardless of which one was created

Change a Logical Volume

Type or select values in entry fields. Press Enter AFTER making all desired changes.

[TOP] [Entry Fields] * Logical volume NAME hd2

Logical volume TYPE [jfs]

POSITION on physical volume middle + RANGE of physical volumes minimum + MAXIMUM NUMBER of PHYSICAL VOLUMES [32] # to use for allocation

Allocate each logical partition copy yes + on a SEPARATE physical volume?

RELOCATE the logical volume during yes + reorganization?

Logical volume LABEL [/usr] MAXIMUM NUMBER of LOGICAL PARTITIONS [512]

SCHEDULING POLICY for reading/writing parallel + logical partition copies

PERMISSIONS read/write + Enable BAD BLOCK relocation? yes + Enable WRITE VERIFY? no + Mirror Write Consistency? yes +

root@pukupuku:/ [132] # lslv hd2

LOGICAL VOLUME: hd2 VOLUME GROUP: rootvg LV IDENTIFIER: 00702137e70a7982.5 PERMISSION: read/write VG STATE: active/complete LV STATE: opened/syncd TYPE: jfs WRITE VERIFY: off

MAX LPs: 512 PP SIZE: 16 megabyte(s) COPIES: 1 SCHED POLICY: parallel LPs: 152 PPs: 152 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: middle UPPER BOUND: 32 MOUNT POINT: /usr LABEL: /usr MIRROR WRITE CONSISTENCY: on

first. Since the user can remove any copy from any disk, at any time, there can be no ordering of copies.

With the parallel scheduling policy, all copies are considered equal. Thus, when a read request arrives at the LVM, there is no first or favorite copy that is accessed for the read. A search is done on the request queues for the drives which contain the mirror physical partition that is required. The drive that has the fewest pending requests is picked as the disk drive that will service the read request.

On write requests, the LVM driver broadcasts to all drives that have a copy of the physical partition that needs updating. Only when all write requests return is the write considered complete and the write complete message is returned to the calling program (see Figure 35).

Mirroring can improve the read performance of a system, but the price to pay is the write performance. Of the two mirroring scheduling policies, parallel and sequential, parallel is the best in terms of disk I/O.

In parallel scheduling policy, when a read request is received, the LVM device driver looks at the queued requests (read and write) and finds the disk with the smallest number of requests waiting to execute.

If mirroring can provide an improvement for the read requests, the price to pay is a longer cycle to write the data. When the LVM disk driver receives a write request (shown as step 1 in Figure 35 on page 114), it must now perform separate writes (shown as step 2 in Figure 35), then each disk must complete its own write operation (shown as step 3 in Figure 35) before the LVM device driver considers a write request as complete and returns write acknowledgement to the caller (shown as step 4 in Figure 35).

Figure 35. Parallel scheduling policy - Write sequence

2.2.2.2 The sequential scheduling policy

The sequential scheduling policy (as opposed to parallel) is based on the idea of an order within the mirrors. All read and write requests (shown as 1 in Figure 36 on page 115) first go through a primary copy that services the request in sequential scheduling policy (shown as 2 and 3 in Figure 36). If the request is a write, then the write request is propagated sequentially to the secondary drives (shown as 4 and 5 in Figure 36). Once the secondary (and tertiary, if applicable) drives have serviced the same write request, then the LVM device driver will consider the write request complete (see Figure 36 on page 115).

If the request is a read, then the read request is forwarded to the primary drive. If the read request is successfully returned from the primary drive, it satisfies the read request from the caller and returns. Otherwise, the secondary (or tertiary, if applicable) drive is examined.

Obviously, there is a performance disadvantage to using the sequential scheduling policy rather than the parallel scheduling policy in mirroring. The question arises why anyone would be interested in using sequential

scheduling policy. The answer is that since there is a definite and defined

primary copy, this will be the first disk always read during a reboot. Thus, it

will be the source mirror copy used when mirror re-synchronization occurs. The implication of this will become clear in “Mirror Write Consistency” on page 117. PV 2 PV 1 PV 3 JFS LVM device dr iver 1 4 2 3 2 3 2 3

Figure 36. Sequential scheduling policy - Write sequence