Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Mar 2009 10:29:16 +0100
From:      Jordi Espasa Clofent <jespasac@minibofh.org>
To:        freebsd-geom@freebsd.org
Subject:   gmirror(8): round-robin vs. load algorithm
Message-ID:  <49AF9B6C.8090908@minibofh.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49AF9B6C.8090908>