Skip to contentSkip to conversation

multipath-tools: Prioritizer based on a latency algorithm

PATCH Superseded Yang Feng 3 participants 6 messages Jun 6, 2017 – Jun 9, 2017 Device mapper

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Yang Feng

author
#0 lore raw

v4 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 from v3:
* Delete Copyright time "2021", Fix according to Xose's reviews.
* Add version for GPL, Fix according to Xose's reviews.

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

Changes from 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 v4 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
In reply to Yang Feng
Quoted 11 lines · Yang Feng

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.

Actually, you're not alone here; several other storage array setups suffer from the same problem.

Eg if you have a site-failover setup with two storage arrays at different locations the problem is more-or-less the same; both arrays potentially will be displaying identical priority information, despite one array being remote.

Similarly, if you have a failover scenario where the individual paths are accessed via different protocols you're facing the same problem.

The underlying reason for this difficulty is the two-stage topology of the current multipath implementation:

- Each path is grouped into a path group
- Priorities are attached to a path group
- Each path group belongs to a multipath device

And as we only have a _single_ prioritizer per path we cannot easily handle this situation.

Ideally we should be able to 'stack' prioritizers, which would work by combining the priority numbers from the stacked/combined prioritizers.

But that would be requiring quite some rework, of course.

Cheers,

Hannes

Signature · 10 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
author
#3 lore raw

Hi Hannes,

Thanks a lot.
Please find my replys as follows.

regards.
-Yang

Quoted 12 lines · Hannes Reinecke
Quoted 11 lines · Yang Feng

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.

Quoted 8 lines

Actually, you're not alone here; several other storage array setups suffer from the same problem.

Eg if you have a site-failover setup with two storage arrays at different locations the problem is more-or-less the same; both arrays potentially will be displaying identical priority information, despite one array being remote.

It's up to the value set of the argument "latency_interval".For example, If latency_interval=10ms, the paths will be grouped in priority groups with path latency 0-10ms, 10-20ms, 20-30ms, etc. If the argument "latency_interval" is set to appropriate value and the distance between two arrays is not enough far, two priorities may be the same, But it's OK, because between two arrays, the gap of average path latency is very small and tolerable.

Quoted 3 lines

Similarly, if you have a failover scenario where the individual paths are accessed via different protocols you're facing the same problem.

Usually, the number of paths grouped into one priority is not only one. And Mostly, the average latency of paths via FC protocol is much smaller than the average latency of paths via iSCSI protocol. Unless all paths via FC are fault, the failover scenario to paths via iSCSI will not happen.

Quoted 7 lines

The underlying reason for this difficulty is the two-stage topology of the current multipath implementation:

- Each path is grouped into a path group
- Priorities are attached to a path group
- Each path group belongs to a multipath device

Quoted 6 lines

And as we only have a _single_ prioritizer per path we cannot easily handle this situation.

Ideally we should be able to 'stack' prioritizers, which would work by combining the priority numbers from the stacked/combined prioritizers.

In this prioritizer, all paths will be grouped into several priorities, and each path group has own priority who's different from the others.

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.

Then all paths can be divided into different path groups. For example, If latency_interval=10ms, the paths will be grouped in priority groups with path latency 0-10ms, 10-20ms, 20-30ms, etc, as follows:

latency_interval latency_interval latency_interval latency_interval

 |------------------|------------------|------------------|...|------------------|
 |  priority rank 1 |  priority rank 2 |  priority rank 3 |...|  priority rank x |
 |------------------|------------------|------------------|...|------------------|
 |     0~10ms       |     10~20ms      |     20~30ms      |...| 10*(x-1)~10*x ms |

Priority Rank Partitioning

Quoted 6 lines

But that would be requiring quite some rework, of course.

Cheers,

Hannes

#4 lore raw

Hello Yang,

Quoted 9 lines
Quoted 8 lines

Actually, you're not alone here; several other storage array setups suffer from the same problem.

Eg if you have a site-failover setup with two storage arrays at different locations the problem is more-or-less the same; both arrays potentially will be displaying identical priority information, despite one array being remote.

Quoted 12 lines

It's up to the value set of the argument "latency_interval".For example,
If latency_interval=10ms, the paths will be grouped in priority groups
with path latency 0-10ms, 10-20ms, 20-30ms, etc. If the argument "latency_interval" is set to appropriate value and the distance between
two arrays is not enough far, two priorities may be the same, But it's
OK, because between two arrays, the gap of average path latency is very
small and tolerable.

I wonder if it would make sense to use "logarithmically" scaled latency intervals here. It wouldn't make a large difference whether the latency is 1ms or 2ms, but if we have paths where the latencies differ by order of magnitude, it would be very important to make a distinction. With the current linear intervals, it would be hard to get this right (us interval size would result in too many intervals, and sec interval size wouldn't allow a distinction between us and ms latencies).

By using logarithmic scale, you could setup the latency intevals e.g like this:

< 10us, 10us-100us, 100us-1ms, 1ms-10ms, 10ms-100ms, > 100ms

IMO that would be better, in particular if the latencies differ strongly between paths.

Regards
Martin

Signature · 8 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
author
#5 lore raw

Hi Martin,

Thanks a lot.
It's a good idea.
The updated patch will be sent later.

Regards,
-Yang

Quoted 44 lines · Martin Wilck

Hello Yang,

Quoted 9 lines
Quoted 8 lines

Actually, you're not alone here; several other storage array setups suffer from the same problem.

Eg if you have a site-failover setup with two storage arrays at different locations the problem is more-or-less the same; both arrays potentially will be displaying identical priority information, despite one array being remote.

Quoted 12 lines

It's up to the value set of the argument "latency_interval".For example,
If latency_interval=10ms, the paths will be grouped in priority groups
with path latency 0-10ms, 10-20ms, 20-30ms, etc. If the argument "latency_interval" is set to appropriate value and the distance between
two arrays is not enough far, two priorities may be the same, But it's
OK, because between two arrays, the gap of average path latency is very
small and tolerable.

I wonder if it would make sense to use "logarithmically" scaled latency intervals here. It wouldn't make a large difference whether the latency is 1ms or 2ms, but if we have paths where the latencies differ by order of magnitude, it would be very important to make a distinction. With the current linear intervals, it would be hard to get this right (us interval size would result in too many intervals, and sec interval size wouldn't allow a distinction between us and ms latencies).

By using logarithmic scale, you could setup the latency intevals e.g like this:

< 10us, 10us-100us, 100us-1ms, 1ms-10ms, 10ms-100ms, > 100ms

IMO that would be better, in particular if the latencies differ strongly between paths.

Regards
Martin