- client: change the calculation of exponential backoff used for

1) individual file transfers
    2) project-level file transfer backoff
    3) scheduler operations
    Old: scale by e.
        Use random backoff in the range min..x
    New: scale by 2.
        Use random backoff in the rand x/2..x
- client: for file transfers, use backoff range of 10 min .. 12 hrs
    rather than 1 min .. 4 hrs


svn path=/trunk/boinc/; revision=21887
This commit is contained in:
David Anderson 2010-07-09 19:24:13 +00:00
parent 922a232a7f
commit ec2c92665a
5 changed files with 63 additions and 42 deletions

View File

@ -4991,3 +4991,20 @@ Charlie 9 Jul 2010
ProjectListCtrl.cpp, .h
mac/
MacAccessiblity.cpp
David 9 Jul 2010
- client: change the calculation of exponential backoff used for
1) individual file transfers
2) project-level file transfer backoff
3) scheduler operations
Old: scale by e.
Use random backoff in the range min..x
New: scale by 2.
Use random backoff in the rand x/2..x
- client: for file transfers, use backoff range of 10 min .. 12 hrs
rather than 1 min .. 4 hrs
client/
client_state.cpp,h
work_fetch.cpp
pers_file_xfer.h

View File

@ -1747,20 +1747,15 @@ int CLIENT_STATE::quit_activities() {
return 0;
}
// return a random double in the range [rmin,rmax)
static inline double rand_range(double rmin, double rmax) {
if (rmin < rmax) {
return drand() * (rmax-rmin) + rmin;
} else {
return rmin;
}
}
// return a random double in the range [MIN,min(e^n,MAX))
// Sometime has failed N times.
// Calculate an exponential backoff between MIN and MAX
//
double calculate_exponential_backoff( int n, double MIN, double MAX) {
double rmax = std::min(MAX, exp((double)n));
return rand_range(MIN, rmax);
double calculate_exponential_backoff(int n, double MIN, double MAX) {
double x = pow(2, (double)n);
x *= MIN;
if (x > MAX) x = MAX;
x *= (.5 + .5*drand());
return x;
}
// See if a timestamp in the client state file

View File

@ -488,25 +488,15 @@ extern double calculate_exponential_backoff(
extern void print_suspend_tasks_message(int);
//////// TIME-RELATED CONSTANTS ////////////
//////// CLIENT INTERNAL
#define POLL_INTERVAL 1.0
// the client will handle I/O (including GUI RPCs)
// for up to POLL_INTERVAL seconds before calling poll_slow_events()
// to call the polling functions
#define CPU_PESSIMISM_FACTOR 0.9
// assume actual CPU utilization will be this multiple
// of what we've actually measured recently
#define WORK_FETCH_PERIOD 60
// see if we need to fetch work at least this often
#define CPU_SCHED_ENFORCE_PERIOD 60
// enforce CPU schedule at least this often
#define DEBT_ADJUST_PERIOD CPU_SCHED_ENFORCE_PERIOD
// debt is adjusted at least this often,
// since adjust_debts() is called from enforce_schedule()
#define GARBAGE_COLLECT_PERIOD 10
// how often to garbage collect
@ -527,6 +517,30 @@ extern void print_suspend_tasks_message(int);
#define GUI_HTTP_POLL_PERIOD 1.0
//////// WORK FETCH
#define WORK_FETCH_PERIOD 60
// see if we need to fetch work at least this often
#define WF_MIN_BACKOFF_INTERVAL 60
#define WF_MAX_BACKOFF_INTERVAL 86400
// if we ask a project for work for a resource and don't get it,
// we do exponential backoff.
// This constant is an upper bound for this.
// E.g., if we need GPU work, we'll end up asking once a day,
// so if the project develops a GPU app,
// we'll find out about it within a day.
//////// CPU SCHEDULING
#define CPU_SCHED_ENFORCE_PERIOD 60
// enforce CPU schedule at least this often
#define DEBT_ADJUST_PERIOD CPU_SCHED_ENFORCE_PERIOD
// debt is adjusted at least this often,
// since adjust_debts() is called from enforce_schedule()
//////// NETWORK
#define CONNECT_ERROR_PERIOD 600.0
#define ALLOW_NETWORK_IF_RECENT_RPC_PERIOD 300
@ -534,6 +548,8 @@ extern void print_suspend_tasks_message(int);
// that requires network access (e.g. attach to project)
// allow it even if setting is "no access"
//////// MISC
#define DAILY_XFER_HISTORY_PERIOD 60
#define MAX_STD (86400)

View File

@ -21,9 +21,11 @@
#include "client_types.h"
#include "file_xfer.h"
// Default values for exponential backoff
#define PERS_RETRY_DELAY_MIN 60 // 1 minute
#define PERS_RETRY_DELAY_MAX (60*60*4) // 4 hours
// min and max for exponential backoff
// these are multiplied by a random factor .5 .. 1
//
#define PERS_RETRY_DELAY_MIN 600
#define PERS_RETRY_DELAY_MAX (3600*12)
#define PERS_GIVEUP (SECONDS_PER_DAY*90)
// give up on xfer if this time elapses since last byte xferred

View File

@ -38,15 +38,6 @@ RSC_WORK_FETCH ati_work_fetch;
RSC_WORK_FETCH cpu_work_fetch;
WORK_FETCH work_fetch;
#define MIN_BACKOFF_INTERVAL 60
#define MAX_BACKOFF_INTERVAL 86400
// if we ask a project for work for a resource and don't get it,
// we do exponential backoff.
// This constant is an upper bound for this.
// E.g., if we need GPU work, we'll end up asking once a day,
// so if the project develops a GPU app,
// we'll find out about it within a day.
#define FETCH_IF_IDLE_INSTANCE 0
// If resource has an idle instance,
// get work for it from the project with greatest LTD,
@ -188,7 +179,7 @@ bool RSC_PROJECT_WORK_FETCH::debt_eligible(PROJECT* p, RSC_WORK_FETCH& rwf) {
// but it's been a while since we asked.
// In this case, accumulate debt until we reach (around) zero, then stop.
//
if (backoff_interval == MAX_BACKOFF_INTERVAL) {
if (backoff_interval == WF_MAX_BACKOFF_INTERVAL) {
if (long_term_debt > -DEBT_ADJUST_PERIOD) {
return false;
}
@ -200,9 +191,9 @@ bool RSC_PROJECT_WORK_FETCH::debt_eligible(PROJECT* p, RSC_WORK_FETCH& rwf) {
void RSC_PROJECT_WORK_FETCH::backoff(PROJECT* p, const char* name) {
if (backoff_interval) {
backoff_interval *= 2;
if (backoff_interval > MAX_BACKOFF_INTERVAL) backoff_interval = MAX_BACKOFF_INTERVAL;
if (backoff_interval > WF_MAX_BACKOFF_INTERVAL) backoff_interval = WF_MAX_BACKOFF_INTERVAL;
} else {
backoff_interval = MIN_BACKOFF_INTERVAL;
backoff_interval = WF_MIN_BACKOFF_INTERVAL;
}
double x = drand()*backoff_interval;
backoff_time = gstate.now + x;