Commit d9ee4a67 authored by Mike Hibler's avatar Mike Hibler

Add frisbee master server mechanisms for turning on dynamic rate tuning.

For the Emulab configuration, we add the new site variable
"images/frisbee/maxrate_dyn" which should be set non-zero to enable
dynamic adjustment. If maxrate_dyn is enabled, then the maxrate_{std,usr}
values are used as both the initial and maximum values for the BW of any
instance. Really, if maxrate_dyn is on, then both of those should be set
to the same value so that all servers are operating the same and the value
should be just above the link BW.

For the "null" configuration (aka, the subboss configuration),
this is set by adding command line options:
    -O dynamicbw=1,bandwidth=1100000000
which would enable it and start/cap the BW at 1.1Gb/sec.
parent 5a50cce6
/*
* Copyright (c) 2010-2012 University of Utah and the Flux Group.
* Copyright (c) 2010-2014 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -54,6 +54,7 @@ extern int debug;
struct emulab_configstate {
int image_maxsize; /* sitevar:images/create/maxsize (in GB) */
int image_maxwait; /* sitevar:images/create/maxwait (in min) */
int image_maxrate_dyn; /* sitevar:images/frisbee/maxrate_dynamic */
int image_maxrate_std; /* sitevar:images/frisbee/maxrate_std (in MB/s) */
int image_maxrate_usr; /* sitevar:images/frisbee/maxrate_usr (in MB/s) */
};
......@@ -98,6 +99,7 @@ static int INELABINELAB = 0;
static uint64_t put_maxsize = 10000000000ULL; /* zero means no limit */
static uint32_t put_maxwait = 2000; /* zero means no limit */
static uint32_t get_maxrate_dyn = 0; /* non-zero means use dynamic */
static uint32_t get_maxrate_std = 72000000; /* zero means no limit */
static uint32_t get_maxrate_usr = 54000000; /* zero means no limit */
......@@ -185,6 +187,15 @@ emulab_read(void)
FrisLog(" image_put_maxwait = %d min",
(int)(put_maxwait/60));
val = emulab_getsitevar("images/frisbee/maxrate_dyn");
if (val) {
ival = atoi(val);
get_maxrate_dyn = ival ? 1 : 0;
free(val);
}
FrisLog(" image_get_maxrate_dyn = %s",
get_maxrate_dyn ? "true" : "false");
val = emulab_getsitevar("images/frisbee/maxrate_std");
if (val) {
ival = atoi(val);
......@@ -193,8 +204,11 @@ emulab_read(void)
get_maxrate_std = (uint32_t)ival;
free(val);
}
FrisLog(" image_get_maxrate_std = %d MB/sec",
(int)(get_maxrate_std/1000000));
if (get_maxrate_dyn)
FrisLog(" image_get_maxrate_std = N/A");
else
FrisLog(" image_get_maxrate_std = %d MB/sec",
(int)(get_maxrate_std/1000000));
val = emulab_getsitevar("images/frisbee/maxrate_usr");
if (val) {
......@@ -204,8 +218,11 @@ emulab_read(void)
get_maxrate_usr = (uint32_t)ival;
free(val);
}
FrisLog(" image_get_maxrate_usr = %d MB/sec",
(int)(get_maxrate_usr/1000000));
if (get_maxrate_dyn)
FrisLog(" image_get_maxrate_usr = N/A");
else
FrisLog(" image_get_maxrate_usr = %d MB/sec",
(int)(get_maxrate_usr/1000000));
return 0;
}
......@@ -217,6 +234,7 @@ emulab_save(void)
cs->image_maxsize = put_maxsize;
cs->image_maxwait = put_maxwait;
cs->image_maxrate_dyn = get_maxrate_dyn;
cs->image_maxrate_std = get_maxrate_std;
cs->image_maxrate_usr = get_maxrate_usr;
......@@ -234,12 +252,21 @@ emulab_restore(void *state)
put_maxwait = cs->image_maxwait;
FrisLog(" image_put_maxwait = %d min",
(int)(put_maxwait/60));
get_maxrate_dyn = cs->image_maxrate_dyn;
FrisLog(" image_get_maxrate_dyn = %s",
get_maxrate_dyn ? "true" : "false");
get_maxrate_std = cs->image_maxrate_std;
FrisLog(" image_get_maxrate_std = %d MB/sec",
(int)(get_maxrate_std/1000000));
if (get_maxrate_dyn)
FrisLog(" image_get_maxrate_std = N/A");
else
FrisLog(" image_get_maxrate_std = %d MB/sec",
(int)(get_maxrate_std/1000000));
get_maxrate_usr = cs->image_maxrate_usr;
FrisLog(" image_get_maxrate_usr = %d MB/sec",
(int)(get_maxrate_usr/1000000));
if (get_maxrate_dyn)
FrisLog(" image_get_maxrate_usr = N/A");
else
FrisLog(" image_get_maxrate_usr = %d MB/sec",
(int)(get_maxrate_usr/1000000));
return 0;
}
......@@ -306,8 +333,12 @@ set_get_values(struct config_host_authinfo *ai, int ix)
else
ii->get_timeout = 60;
/* get_options */
snprintf(str, sizeof str, " -W %u",
/*
* get_options: for dynamic rate adjustment, we use the std/usr
* bandwidth value as the maximum bandwidth.
*/
snprintf(str, sizeof str, " %s-W %u",
get_maxrate_dyn ? "-D " : "",
isindir(STDIMAGEDIR, ii->path) ?
get_maxrate_std : get_maxrate_usr);
#if 0
......
/*
* Copyright (c) 2010-2013 University of Utah and the Flux Group.
* Copyright (c) 2010-2014 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -52,6 +52,8 @@ static char *DEFAULT_MCNUMPORT = "0";
static char *indexfile;
char *imagedir = NULL;
static char *rimagedir;
static uint32_t maxrate = 100000000;
static int dynrate = 0;
/* Multicast address/port base info */
static int mc_a, mc_b, mc_c, mc_port_lo, mc_port_num;
......@@ -69,7 +71,13 @@ null_deinit(void)
static int
null_read(void)
{
/* "Reading" the config file is a no-op. */
/* "Reading" the config file is a no-op. Just echo settings. */
FrisLog(" dynamic bandwidth = %s", dynrate ? "true" : "false");
if (dynrate)
FrisLog(" max bandwidth = N/A");
else
FrisLog(" max bandwidth = %d MB/sec",
(int)(maxrate/1000000));
return 0;
}
......@@ -85,6 +93,13 @@ null_save(void)
static int
null_restore(void *state)
{
FrisLog(" dynamic bandwidth = %s", dynrate ? "true" : "false");
if (dynrate)
FrisLog(" max bandwidth = N/A");
else
FrisLog(" max bandwidth = %d MB/sec",
(int)(maxrate/1000000));
return 0;
}
......@@ -133,8 +148,9 @@ set_get_values(struct config_host_authinfo *ai, int ix)
ai->imageinfo[ix].get_timeout = 180;
/* get_options */
strcpy(str, "");
strcat(str, " -W 100000000 -K 15");
snprintf(str, sizeof str, " %s-W %u",
dynrate ? "-D " : "", maxrate);
strcat(str, " -K 15");
ai->imageinfo[ix].get_options = mystrdup(str);
/* and whack the put_* fields */
......@@ -651,6 +667,7 @@ null_get_host_authinfo(struct in_addr *req, struct in_addr *host,
return 0;
}
#if 0
static void
dump_host_authinfo(FILE *fd, char *node, char *cmd,
struct config_host_authinfo *ai)
......@@ -673,6 +690,7 @@ dump_host_authinfo(FILE *fd, char *node, char *cmd,
fprintf(fd, "\n");
}
#endif
static void
null_dump(FILE *fd)
......@@ -705,17 +723,31 @@ null_init(char *opts)
called++;
/*
* XXX the only option we recognize right now is
* mcaddr=A.B.C.D
* Options:
* mcaddr=A.B.C.D MC base address
* bandwidth=NNNNNNNN Max bandwidth of a server
* dynamicbw=(1|0) Use dynamic bandwidth control
*/
if (opts && opts[0]) {
char *cp = index(opts, '=');
if (cp) {
*cp = 0;
if (strcmp(opts, "mcaddr") == 0)
DEFAULT_MCADDR = cp + 1;
*cp = '=';
char *opt;
opts = mystrdup(opts);
while ((opt = strsep(&opts, ",")) != NULL) {
char *cp = index(opt, '=');
if (cp) {
*cp = 0;
if (strcmp(opt, "mcaddr") == 0)
DEFAULT_MCADDR = cp + 1;
else if (strcmp(opt, "bandwidth") == 0)
maxrate = (uint32_t)
strtol(cp+1, NULL, 10);
else if (strcmp(opt, "dynamicbw") == 0)
dynrate =
(strtol(cp+1, NULL, 10) != 0) ?
1 : 0;
}
}
free(opts);
}
if (imagedir == NULL)
......
/*
* Copyright (c) 2010-2013 University of Utah and the Flux Group.
* Copyright (c) 2010-2014 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......
......@@ -111,6 +111,7 @@ INSERT INTO sitevariables VALUES ('images/create/maxsize',NULL,'6','Max size (GB
INSERT INTO sitevariables VALUES ('general/testbed_shutdown',NULL,'0','Non-zero value indicates that the testbed is shutdown and scripts should not do anything when they run. DO NOT SET THIS BY HAND!',0);
INSERT INTO sitevariables VALUES ('images/frisbee/maxrate_std',NULL,'72000000','Max bandwidth (Bytes/sec) at which to distribute standard images from the /usr/testbed/images directory.',0);
INSERT INTO sitevariables VALUES ('images/frisbee/maxrate_usr',NULL,'54000000','Max bandwidth (Bytes/sec) at which to distribute user-defined images from the /proj/.../images directory.',0);
INSERT INTO sitevariables VALUES ('images/frisbee/maxrate_dyn',NULL,'0','If non-zero, use bandwidth throttling on all frisbee servers; maxrate_{std,usr} serve as initial BW values.',0);
INSERT INTO sitevariables VALUES ('general/idlepower_enable',NULL,'0','Enable idle power down to conserve electricity',0);
INSERT INTO sitevariables VALUES ('general/idlepower_idletime',NULL,'3600','Maximum number of seconds idle before a node is powered down to conserve electricity',0);
INSERT INTO sitevariables VALUES ('general/autoswap_max',NULL,'120','Maximum number of hours for the experiment autoswap limit.',0);
......
#
# Create site variables for frisbee server transmission speeds.
# These were previously hardwired in frisbeelauncher and mfrisbeed.
# Default to those historic values.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $var = "images/frisbee/maxrate_dyn";
if (!TBSiteVarExists($var)) {
my $desc = "If non-zero, use bandwidth throttling on all frisbee ".
"servers; maxrate_{std,usr} serve as initial BW values.";
my $defval = "0";
DBQueryFatal("INSERT INTO sitevariables VALUES ".
"('$var',NULL,'$defval','$desc',0)");
}
return 0;
}
1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment