dm-service-time.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. ===============
  2. dm-service-time
  3. ===============
  4. dm-service-time is a path selector module for device-mapper targets,
  5. which selects a path with the shortest estimated service time for
  6. the incoming I/O.
  7. The service time for each path is estimated by dividing the total size
  8. of in-flight I/Os on a path with the performance value of the path.
  9. The performance value is a relative throughput value among all paths
  10. in a path-group, and it can be specified as a table argument.
  11. The path selector name is 'service-time'.
  12. Table parameters for each path:
  13. [<repeat_count> [<relative_throughput>]]
  14. <repeat_count>:
  15. The number of I/Os to dispatch using the selected
  16. path before switching to the next path.
  17. If not given, internal default is used. To check
  18. the default value, see the activated table.
  19. <relative_throughput>:
  20. The relative throughput value of the path
  21. among all paths in the path-group.
  22. The valid range is 0-100.
  23. If not given, minimum value '1' is used.
  24. If '0' is given, the path isn't selected while
  25. other paths having a positive value are available.
  26. Status for each path:
  27. <status> <fail-count> <in-flight-size> <relative_throughput>
  28. <status>:
  29. 'A' if the path is active, 'F' if the path is failed.
  30. <fail-count>:
  31. The number of path failures.
  32. <in-flight-size>:
  33. The size of in-flight I/Os on the path.
  34. <relative_throughput>:
  35. The relative throughput value of the path
  36. among all paths in the path-group.
  37. Algorithm
  38. =========
  39. dm-service-time adds the I/O size to 'in-flight-size' when the I/O is
  40. dispatched and subtracts when completed.
  41. Basically, dm-service-time selects a path having minimum service time
  42. which is calculated by::
  43. ('in-flight-size' + 'size-of-incoming-io') / 'relative_throughput'
  44. However, some optimizations below are used to reduce the calculation
  45. as much as possible.
  46. 1. If the paths have the same 'relative_throughput', skip
  47. the division and just compare the 'in-flight-size'.
  48. 2. If the paths have the same 'in-flight-size', skip the division
  49. and just compare the 'relative_throughput'.
  50. 3. If some paths have non-zero 'relative_throughput' and others
  51. have zero 'relative_throughput', ignore those paths with zero
  52. 'relative_throughput'.
  53. If such optimizations can't be applied, calculate service time, and
  54. compare service time.
  55. If calculated service time is equal, the path having maximum
  56. 'relative_throughput' may be better. So compare 'relative_throughput'
  57. then.
  58. Examples
  59. ========
  60. In case that 2 paths (sda and sdb) are used with repeat_count == 128
  61. and sda has an average throughput 1GB/s and sdb has 4GB/s,
  62. 'relative_throughput' value may be '1' for sda and '4' for sdb::
  63. # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4" \
  64. dmsetup create test
  65. #
  66. # dmsetup table
  67. test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4
  68. #
  69. # dmsetup status
  70. 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
  71. Or '2' for sda and '8' for sdb would be also true::
  72. # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8" \
  73. dmsetup create test
  74. #
  75. # dmsetup table
  76. test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8
  77. #
  78. # dmsetup status
  79. 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