dm service time: measure service time rather than approximate it
RFC PATCH 1/1 dm service time: measure service time rather than approximate it
The DM multipath service-time path-selector has historically tracked the amount of outstanding IO per path and used that to approximate the service-time of each path. In practice this has shown itself to work fairly well but we can do better by measuring the actual service-time during IO completion and using it as the basis for path selection.
Measuring the actual service-time is still prone to inaccuracies given that service-times vary with IO size. But to counter any potential for drawing incorrect conclusions about the service-times of a given path the measured service-times are reset periodically.
This approach has provided a 10% increase in the selection of a path that was forcibly made to be less loaded than the alternative path.
--- drivers/md/dm-mpath.c | 6 ++- drivers/md/dm-path-selector.h | 5 ++- drivers/md/dm-queue-length.c | 4 +- drivers/md/dm-service-time.c | 101 +++++++++++------------------------------- 4 files changed, 35 insertions(+), 81 deletions(-)
drivers/md/dm-mpath.c +4 -2
@@ -105,6 +105,7 @@ struct multipath {struct dm_mpath_io {struct pgpath *pgpath;size_t nr_bytes; +ktime_t io_start_time; };typedef int (*action_fn ) (struct pgpath *pgpath);
@@ -507,7 +508,7 @@ static int __multipath_map(struct dm_target *ti, struct request *clone,if (pgpath->pg->ps.type->start_io) pgpath->pg->ps.type->start_io (&pgpath->pg->ps, &pgpath->path, - nr_bytes); + nr_bytes, &mpio->io_start_time);return DM_MAPIO_REMAPPED ; }
@@ -1374,7 +1375,8 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,if (pgpath) { ps = &pgpath->pg->ps;if (ps->type->end_io) - ps->type->end_io (ps, &pgpath->path, mpio->nr_bytes); + ps->type->end_io (ps, &pgpath->path, mpio->nr_bytes, + &mpio->io_start_time); }clear_request_fn_mpio (m, map_context);
drivers/md/dm-path-selector.h +3 -2
@@ -13,6 +13,7 @@#define DM_PATH_SELECTOR_H #include <linux/device-mapper.h> +#include <linux/ktime.h> #include "dm-mpath.h"
@@ -72,9 +73,9 @@ struct path_selector_type { status_type_t type, char *result, unsigned int maxlen);int (*start_io) (struct path_selector *ps,struct dm_path *path, -size_t nr_bytes); +size_t nr_bytes,ktime_t *io_start_time);int (*end_io) (struct path_selector *ps,struct dm_path *path, -size_t nr_bytes); +size_t nr_bytes,ktime_t *io_start_time); };/* Register a path selector */
drivers/md/dm-queue-length.c +2 -2
@@ -217,7 +217,7 @@ out: }static int ql_start_io (struct path_selector *ps,struct dm_path *path, -size_t nr_bytes) +size_t nr_bytes,ktime_t *io_start_time) {struct path_info *pi = path->pscontext;
@@ -227,7 +227,7 @@ static int ql_start_io(struct path_selector *ps, struct dm_path *path, }static int ql_end_io (struct path_selector *ps,struct dm_path *path, -size_t nr_bytes) +size_t nr_bytes,ktime_t *io_start_time) {struct path_info *pi = path->pscontext;
drivers/md/dm-service-time.c +26 -75
168 lines not on this page · raw message
Signature · 1 line
2.6.4 (Apple Git-63)
Quoted 11 lines · Mike Snitzer
The DM multipath service-time path-selector has historically tracked the amount of outstanding IO per path and used that to approximate the service-time of each path. In practice this has shown itself to work fairly well but we can do better by measuring the actual service-time during IO completion and using it as the basis for path selection.
Measuring the actual service-time is still prone to inaccuracies given that service-times vary with IO size. But to counter any potential for drawing incorrect conclusions about the service-times of a given path the measured service-times are reset periodically.
Quoted 5 lines
This approach has provided a 10% increase in the selection of a path that was forcibly made to be less loaded than the alternative path.
Reported-by Todd Gill <[email protected]>Signed-off-by Mike Snitzer <[email protected]>
It should be noted that I have not looked at the implications on actual throughput or system load. But I wanted to get this RFC out to see what others thought about making dm-service-time more intuitive in its implementation.
Junichi, it'd also be great if you could provide historic context for why you elected to approximate the service-time based on outstanding IO rather than measure the actual service-time of each path.
Thanks,
Mike
Quoted 17 lines · Mike Snitzer
Quoted 14 lines · Mike Snitzer
The DM multipath service-time path-selector has historically tracked the amount of outstanding IO per path and used that to approximate the service-time of each path. In practice this has shown itself to work fairly well but we can do better by measuring the actual service-time during IO completion and using it as the basis for path selection.
Measuring the actual service-time is still prone to inaccuracies given that service-times vary with IO size. But to counter any potential for drawing incorrect conclusions about the service-times of a given path the measured service-times are reset periodically.
This approach has provided a 10% increase in the selection of a path that was forcibly made to be less loaded than the alternative path.
Quoted 7 lines
Quoted 2 lines
Reported-by Todd Gill <[email protected]>Signed-off-by Mike Snitzer <[email protected]>It should be noted that I have not looked at the implications on actual throughput or system load. But I wanted to get this RFC out to see what others thought about making dm-service-time more intuitive in its implementation.
I have notice fio's total and completion latency ('lat' and 'clat') go up on this simple SAS testbed:
before:
write: io=345920KB, bw=34379KB/s, iops=537, runt= 10062msec
slat (usec): min=10, max=47, avg=22.51, stdev= 3.71
clat (msec): min=1, max=146, avg=59.50, stdev=11.84
lat (msec): min=1, max=146, avg=59.52, stdev=11.84after:
write: io=347456KB, bw=34545KB/s, iops=539, runt= 10058msec
slat (usec): min=6, max=46, avg=20.50, stdev= 3.68
clat (usec): min=385, max=146556, avg=59219.94, stdev=11580.00
lat (usec): min=403, max=146573, avg=59240.87, stdev=11580.57Which obviously isn't what we want (might speak to why Junichi decided to approximate service-time)...