Skip to contentSkip to conversation

multipath-tools: Prioritizer based on a latency algorithm

PATCH Superseded Yang Feng 2 participants 4 messages Jun 5, 2017 – Jun 6, 2017 Device mapper

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Yang Feng

author
#0 lore raw

v3 cover multipath-tools: Prioritizer based on a latency algorithm

This patch value is in the following:
1. In the Storage-Backup environment of HyperCluster, includes one storage array near to the host and one remote storage array, and the two storage arrays have the same hardware.The same LUN is writed or readed by the two storage arrays. However, usually, the average latency of the paths of the remote storage array is much higher than the near storage array's. Apparently, the prioritizer can be a good automatic solution. And the current selectors don't solve it, IOs will send to the paths of the remote storage array, IOPS will be influenced unavoidably.

2. In the environment of single storage array, the prioritizer can automatically separate the paths who's latency is much higher, IOs will not send to this paths. But the current selectors don't solve this problem, IOPS will be influenced unavoidably.

Changes to v2:
* Reorganize the commit comment and patch format
* Added Benjamin, Martin and Xose's Reviewed-by

Changes to v1:
* The value of "MIN_IO_NUM" is set 2 from 10
* Fix according to Benjamin, Martin and Xose's reviews.

Yang Feng (1):
multipath-tools: Prioritizer based on a latency algorithm

 libmultipath/prio.h                      |   1 +
 libmultipath/prioritizers/Makefile       |   4 +
 libmultipath/prioritizers/path_latency.c | 272 +++++++++++++++++++++++++++++++
 multipath/multipath.conf.5               |  18 ++
 4 files changed, 295 insertions(+)
 create mode 100644 libmultipath/prioritizers/path_latency.c
Signature · 1 line
2.6.4.windows.1
author
#1 lore raw

PATCH v3 1/1 multipath-tools: Prioritizer based on a latency algorithm

libmultipath/prioritizers: Prioritizer for device mapper multipath, where the corresponding priority values of specific paths are provided by a latency algorithm. And the latency algorithm is dependent on the following arguments(latency_interval and io_num).
The principle of the algorithm is illustrated as follows:
1. By sending a certain number "cons_num" of read IOs to the current path continuously, the IOs' average latency can be calculated.
2. According to the average latency of each path and the weight value "latency_interval", the priority "rc" of each path can be provided.

 latency_interval   latency_interval   latency_interval       latency_interval
 |------------------|------------------|------------------|...|------------------|
 |  priority rank 1 |  priority rank 2 |  priority rank 3 |...|  priority rank x |
 |------------------|------------------|------------------|...|------------------|

Priority Rank Partitioning

---
 libmultipath/prio.h                      |   1 +
 libmultipath/prioritizers/Makefile       |   4 +
 libmultipath/prioritizers/path_latency.c | 272 +++++++++++++++++++++++++++++++
 multipath/multipath.conf.5               |  18 ++
 4 files changed, 295 insertions(+)
 create mode 100644 libmultipath/prioritizers/path_latency.c
libmultipath/prio.h +1 -0
index 0193c52..c97fe39 100644
@@ -29,6 +29,7 @@ struct path;
 #define PRIO_RDAC		"rdac"
 #define PRIO_WEIGHTED_PATH	"weightedpath"
 #define PRIO_SYSFS		"sysfs"
+#define PRIO_PATH_LATENCY	"path_latency"
 
 /*
  * Value used to mark the fact prio was not defined
libmultipath/prioritizers/Makefile +4 -0
index 36b42e4..ca47cdf 100644
@@ -18,6 +18,7 @@ LIBS = \
 	libpriorandom.so \
 	libpriordac.so \
 	libprioweightedpath.so \
+	libpriopath_latency.so \
 	libpriosysfs.so
 
 all: $(LIBS)
@@ -25,6 +26,9 @@ all: $(LIBS)
 libprioalua.so: alua.o alua_rtpg.o
 	$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^
 
+libpriopath_latency.so: path_latency.o  ../checkers/libsg.o
+	$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ -lm
+
 libprio%.so: %.o
 	$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^
 
libmultipath/prioritizers/path_latency.c new file +272 -0

272 lines not on this page · raw message

multipath/multipath.conf.5 +18 -0
index 5939688..2317046 100644
@@ -293,6 +293,10 @@ Generate a random priority between 1 and 10.
 Generate the path priority based on the regular expression and the
 priority provided as argument. Requires prio_args keyword.
 .TP
+.I path_latency
+Generate the path priority based on a latency algorithm.
+Requires prio_args keyword.
+.TP
 .I datacore
 .\" XXX
 ???. Requires prio_args keyword.
@@ -333,6 +337,20 @@ these values can be looked up through sysfs or by running \fImultipathd show pat
 "%N:%R:%n:%r"\fR. For example: 0x200100e08ba0aea0:0x210100e08ba0aea0:.*:.* , .*:.*:iqn.2009-10.com.redhat.msp.lab.ask-06:.*
 .RE
 .TP 12
+.I path_latency
+Needs a value of the form
+\fI"<latency_interval>|<io_num>"\fR
+.RS
+.TP 8
+.I latency_interval
+The interval values of average latency between two different neighbour ranks of path priority, used to partition different priority ranks.
+Form: XXs, or XXXus, or XXXms. Unit: Second, or Microsecond, or Millisecond. Valid Values: Integer, s [1, 60], ms [1, 60000], us [1, 60000000],
+For example: If latency_interval=10ms, the paths will be grouped in priority groups with path latency 0-10ms, 10-20ms, 20-30ms, etc..
+.TP
+.I io_num
+The number of read IOs sent to the current path continuously, used to calculate the average path latency. Valid Values: Integer, [2, 200].
+.RE
+.TP 12
 .I alua
 If \fIexclusive_pref_bit\fR is set, paths with the \fIpreferred path\fR bit
 set will always be in their own path group.
Signature · 1 line
2.6.4.windows.1
#2 lore raw

libmultipath/prioritizers/path_latency.c line 2

Quoted 8 lines · Yang Feng
libmultipath/prioritizers/path_latency.c new file +2 -0
new file mode 100644
index 0000000..081f546
@@ -0,0 +1,272 @@
+/*
+ * (C) Copyright HUAWEI Technology Corp. 2017, 2021   All Rights Reserved.
                                                  ^^^^  <-----------

2021 ???

Quoted 8 lines
libmultipath/prioritizers/path_latency.c new file +8 -0
+ *
+ * main.c
+ *
+ * Prioritizer for device mapper multipath, where the corresponding priority
+ * values of specific paths are provided by a latency algorithm. And the
+ * latency algorithm is dependent on arguments.
+ *
+ * The principle of the algorithm as follows:

libmultipath/prioritizers/path_latency.c line 20

Quoted 10 lines
libmultipath/prioritizers/path_latency.c new file +10 -0
+ * 1. By sending a certain number "io_num" of read IOs to the current path
+ *    continuously, the IOs' average latency can be calculated.
+ * 2. According to the average latency of each path and the weight value
+ *    "latency_interval", the priority "rc" of each path can be provided.
+ *
+ * Author(s): Yang Feng <[email protected]>
+ *            Zou Ming <[email protected]>
+ *            Guan Junxiong <[email protected]>
+ *
+ * This file is released under the GPL.
                                      ^^^  <-----------

"GPL" is not a licence. The *version* must be specified.

And it would be nice to start using SPDX tags ( https://spdx.org/ ) for new files.

BTW: LFC191 Compliance Basics for Developers course is FREE
https://training.linuxfoundation.org/linux-courses/open-source-compliance-courses/compliance-basics-for-developers

author
#3 lore raw

Hi Xose,

Thanks, the updated patch will be sent later.

Best.

Quoted 12 lines · Xose Vazquez Perez

libmultipath/prioritizers/path_latency.c line 2

Quoted 8 lines · Yang Feng
libmultipath/prioritizers/path_latency.c new file +2 -0
new file mode 100644
index 0000000..081f546
@@ -0,0 +1,272 @@
+/*
+ * (C) Copyright HUAWEI Technology Corp. 2017, 2021   All Rights Reserved.
                                                  ^^^^  <-----------
Quoted 2 lines

2021 ???

Thanks, "2021" will be deleted.

Quoted 11 lines

libmultipath/prioritizers/path_latency.c line 20

Quoted 6 lines
libmultipath/prioritizers/path_latency.c new file +6 -0
+ *
+ * Author(s): Yang Feng <[email protected]>
+ *            Zou Ming <[email protected]>
+ *            Guan Junxiong <[email protected]>
+ *
+ * This file is released under the GPL.
                                      ^^^  <-----------

"GPL" is not a licence. The *version* must be specified.

Quoted 9 lines

And it would be nice to start using SPDX tags ( https://spdx.org/ ) for new files.

BTW: LFC191 Compliance Basics for Developers course is FREE
https://training.linuxfoundation.org/linux-courses/open-source-compliance-courses/compliance-basics-for-developers

.

"This file is released under the GPL." will be modified to "This file is released under the GPL version 2, or any later version."