0001 ===============
0002 dm-service-time
0003 ===============
0004
0005 dm-service-time is a path selector module for device-mapper targets,
0006 which selects a path with the shortest estimated service time for
0007 the incoming I/O.
0008
0009 The service time for each path is estimated by dividing the total size
0010 of in-flight I/Os on a path with the performance value of the path.
0011 The performance value is a relative throughput value among all paths
0012 in a path-group, and it can be specified as a table argument.
0013
0014 The path selector name is 'service-time'.
0015
0016 Table parameters for each path:
0017
0018 [<repeat_count> [<relative_throughput>]]
0019 <repeat_count>:
0020 The number of I/Os to dispatch using the selected
0021 path before switching to the next path.
0022 If not given, internal default is used. To check
0023 the default value, see the activated table.
0024 <relative_throughput>:
0025 The relative throughput value of the path
0026 among all paths in the path-group.
0027 The valid range is 0-100.
0028 If not given, minimum value '1' is used.
0029 If '0' is given, the path isn't selected while
0030 other paths having a positive value are available.
0031
0032 Status for each path:
0033
0034 <status> <fail-count> <in-flight-size> <relative_throughput>
0035 <status>:
0036 'A' if the path is active, 'F' if the path is failed.
0037 <fail-count>:
0038 The number of path failures.
0039 <in-flight-size>:
0040 The size of in-flight I/Os on the path.
0041 <relative_throughput>:
0042 The relative throughput value of the path
0043 among all paths in the path-group.
0044
0045
0046 Algorithm
0047 =========
0048
0049 dm-service-time adds the I/O size to 'in-flight-size' when the I/O is
0050 dispatched and subtracts when completed.
0051 Basically, dm-service-time selects a path having minimum service time
0052 which is calculated by::
0053
0054 ('in-flight-size' + 'size-of-incoming-io') / 'relative_throughput'
0055
0056 However, some optimizations below are used to reduce the calculation
0057 as much as possible.
0058
0059 1. If the paths have the same 'relative_throughput', skip
0060 the division and just compare the 'in-flight-size'.
0061
0062 2. If the paths have the same 'in-flight-size', skip the division
0063 and just compare the 'relative_throughput'.
0064
0065 3. If some paths have non-zero 'relative_throughput' and others
0066 have zero 'relative_throughput', ignore those paths with zero
0067 'relative_throughput'.
0068
0069 If such optimizations can't be applied, calculate service time, and
0070 compare service time.
0071 If calculated service time is equal, the path having maximum
0072 'relative_throughput' may be better. So compare 'relative_throughput'
0073 then.
0074
0075
0076 Examples
0077 ========
0078 In case that 2 paths (sda and sdb) are used with repeat_count == 128
0079 and sda has an average throughput 1GB/s and sdb has 4GB/s,
0080 'relative_throughput' value may be '1' for sda and '4' for sdb::
0081
0082 # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4" \
0083 dmsetup create test
0084 #
0085 # dmsetup table
0086 test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4
0087 #
0088 # dmsetup status
0089 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 1 8:16 A 0 0 4
0090
0091
0092 Or '2' for sda and '8' for sdb would be also true::
0093
0094 # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8" \
0095 dmsetup create test
0096 #
0097 # dmsetup table
0098 test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8
0099 #
0100 # dmsetup status
0101 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 2 8:16 A 0 0 8