Commit 9461993c authored by Mike Hibler's avatar Mike Hibler

Add images/frisbee/maxlinger sitevar to replace hardcoded value.

This is the time in seconds that a frisbeed will hang around after
the last time it receives a packet. Traditionally, this was 1800
(30 minutes!) but now we default it to 180.
parent 05697050
......@@ -58,6 +58,7 @@ struct emulab_configstate {
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) */
int image_maxlinger; /* sitevar:images/frisbee/maxlinger (in sec) */
};
/* Extra info associated with a image information entry */
......@@ -129,6 +130,7 @@ static uint32_t put_maxiwait = 120; /* 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 */
static int get_maxlinger = 3600; /* zero means forever */
/* Standard image directory: assumed to be "TBROOT/images" */
static char *STDIMAGEDIR;
......@@ -262,6 +264,22 @@ emulab_read(void)
FrisLog(" image_get_maxrate_usr = %d MB/sec",
(int)(get_maxrate_usr/1000000));
val = emulab_getsitevar("images/frisbee/maxlinger");
if (val) {
ival = atoi(val);
if (ival < 0)
ival = -1;
get_maxlinger = ival;
free(val);
}
if (get_maxlinger == -1)
FrisLog(" server exits after last client leaves");
else if (get_maxlinger == 0)
FrisLog(" server never exits");
else
FrisLog(" server exits after %d seconds idle",
get_maxlinger);
return 0;
}
......@@ -276,6 +294,7 @@ emulab_save(void)
cs->image_maxrate_dyn = get_maxrate_dyn;
cs->image_maxrate_std = get_maxrate_std;
cs->image_maxrate_usr = get_maxrate_usr;
cs->image_maxlinger = get_maxlinger;
return (void *)cs;
}
......@@ -309,6 +328,14 @@ emulab_restore(void *state)
else
FrisLog(" image_get_maxrate_usr = %d MB/sec",
(int)(get_maxrate_usr/1000000));
get_maxlinger = cs->image_maxlinger;
if (get_maxlinger == -1)
FrisLog(" server exits after last client leaves");
else if (get_maxlinger == 0)
FrisLog(" server never exits");
else
FrisLog(" server exits after %d seconds idle",
get_maxlinger);
return 0;
}
......@@ -355,24 +382,13 @@ set_get_values(struct config_host_authinfo *ai, int ix)
#endif
/* get_timeout */
/*
* In the short run, we leave this at pre-master-server levels
* for compatibility (we still support advance startup of servers
* via the localhost proxy).
*
* We also need this at Utah while we work out some MC problems on
* our control net (sometimes nodes can take minutes before they
* actually hook up with the server.
*
* In an inner elab, neither of these apply.
*/
if (!INELABINELAB)
ii->get_timeout = 1800;
ii->get_timeout = get_maxlinger;
/*
* We use a small server inactive timeout since we no longer have
* to start up a frisbeed well in advance of the client(s).
*/
else
if (INELABINELAB && ii->get_timeout > 60)
ii->get_timeout = 60;
/*
......
/*
* Copyright (c) 2010-2014 University of Utah and the Flux Group.
* Copyright (c) 2010-2015 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -55,6 +55,17 @@ static char *rimagedir;
static uint32_t maxrate = 100000000;
static int dynrate = 0;
/*
* We use a small server inactive timeout since we no longer have
* to start up a frisbeed well in advance of the client(s).
*
* XXX we cranked this from 60 to 180 seconds to account for clients
* with lots of write buffer memory but slow disks, giving them time
* to flush all their buffers and report their stats before we give
* up on them.
*/
static int maxlinger = 180;
/* Multicast address/port base info */
static int mc_a, mc_b, mc_c, mc_port_lo, mc_port_num;
......@@ -78,6 +89,15 @@ null_read(void)
else
FrisLog(" max bandwidth = %d MB/sec",
(int)(maxrate/1000000));
if (maxlinger < 0)
FrisLog(" server exits after last client leaves");
else if (maxlinger == 0)
FrisLog(" server never exits");
else
FrisLog(" server exits after %d seconds idle",
maxlinger);
return 0;
}
......@@ -100,6 +120,14 @@ null_restore(void *state)
FrisLog(" max bandwidth = %d MB/sec",
(int)(maxrate/1000000));
if (maxlinger < 0)
FrisLog(" server exits after last client leaves");
else if (maxlinger == 0)
FrisLog(" server never exits");
else
FrisLog(" server exits after %d seconds idle",
maxlinger);
return 0;
}
......@@ -136,16 +164,7 @@ set_get_values(struct config_host_authinfo *ai, int ix)
#endif
/* get_timeout */
/*
* We use a small server inactive timeout since we no longer have
* to start up a frisbeed well in advance of the client(s).
*
* XXX we cranked this from 60 to 180 seconds to account for clients
* with lots of write buffer memory but slow disks, giving them time
* to flush all their buffers and report their stats before we give
* up on them.
*/
ai->imageinfo[ix].get_timeout = 180;
ai->imageinfo[ix].get_timeout = maxlinger;
/* get_options */
snprintf(str, sizeof str, " %s-W %u",
......@@ -739,6 +758,7 @@ null_init(char *opts)
* mcaddr=A.B.C.D MC base address
* bandwidth=NNNNNNNN Max bandwidth of a server
* dynamicbw=(1|0) Use dynamic bandwidth control
* maxlinger=N Server lingers for N seconds after last req
*/
if (opts && opts[0]) {
char *opt;
......@@ -757,6 +777,8 @@ null_init(char *opts)
dynrate =
(strtol(cp+1, NULL, 10) != 0) ?
1 : 0;
else if (strcmp(opt, "maxlinger") == 0)
maxlinger = strtol(cp+1, NULL, 10);
}
}
free(opts);
......
/*
* Copyright (c) 2010-2014 University of Utah and the Flux Group.
* Copyright (c) 2010-2015 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -1723,7 +1723,7 @@ startchild(struct childinfo *ci)
int timo = ci->timeout;
/* XXX compensate for 2s sleep in handle_get */
if (timo)
if (timo > 0)
timo += 2;
pname = FRISBEE_SERVER;
......
......@@ -112,6 +112,7 @@ INSERT INTO sitevariables VALUES ('general/testbed_shutdown',NULL,'0','Non-zero
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 ('images/frisbee/maxlinger',NULL,'180','Seconds to wait after last request before exiting; 0 means never exit, -1 means exit after last client leaves.',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 idle-wait time.
# This values was previously hardwired in mfrisbeed.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $var = "images/frisbee/maxlinger";
if (!TBSiteVarExists($var)) {
my $desc = "Seconds to wait after last request before exiting; ".
"0 means never exit, -1 means exit after last client leaves.";
my $defval = "180";
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