gmirror(8): round-robin vs. load algorithm
Jordi Espasa Clofent
jespasac at minibofh.org
Thu Mar 5 01:46:35 PST 2009
Hi all,
It's supposed that 'round-robin' algorithm has the best performance in
gmirror(8).
However, looking directly at code (1) I see that the only difference
between 'round-robin' and 'load' algorithm is:
[...]
binuptime(&curtime);
/*
* Find a disk which the smallest load.
*/
disk = NULL;
LIST_FOREACH(dp, &sc->sc_disks, d_next) {
if (dp->d_state != G_MIRROR_DISK_STATE_ACTIVE)
continue;
/* If disk wasn't used for more than 2 sec, use it. */
if (curtime.sec - dp->d_last_used.sec >= 2) {
disk = dp;
break;
}
if (disk == NULL ||
bintime_cmp(&dp->d_delay, &disk->d_delay) < 0) {
disk = dp;
}
}
[...]
The key is in "/* If disk wasn't used for more than 2 sec, use it. */",
but, for the rest, 'load' algorithm implementation seems the same as
round-robin. If I'm right, my question is
¿where is the use of 'load' recommended?
I understand that 'load' will be good in servers with a lot of disk
activity (large disk I/O could provoque that gmirror expulses a mirror
member or even reboot or panics the system) because it try always the
low-loaded disk.
(1)
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/geom/mirror/g_mirror.c?rev=1.93.6.1;content-type=text%2Fplain
--
Thanks,
Jordi Espasa Clofent
More information about the freebsd-geom
mailing list