diff --git a/checkin_notes b/checkin_notes index 346f4fcff1..ce067303b0 100755 --- a/checkin_notes +++ b/checkin_notes @@ -315,3 +315,16 @@ David 11 Jan 2006 sched/ file_upload_handler.C + +David 11 Jan 2006 + - Core client: add a flow control mechanism for the case where + output files are generated faster than they can be uploaded + (otherwise we'll fill up the disk). + The mechanism: don't start new results for a project + that has > 2 uploads in progress. + Note: this actually happens with Cunning Plan + (5 MB output files, 60 sec CPU) over a DSL line + + client/ + client_types.h + cs_apps.C diff --git a/client/client_types.h b/client/client_types.h index 9bad5addc7..be63938215 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -274,6 +274,9 @@ public: // project in the current scheduling period (secs) struct RESULT *next_runnable_result; // the next result to run for this project + int nactive_uploads; + // number of file uploads in progress. + // Don't start new results if these exceeds 2. double work_request; // the unit is "normalized CPU seconds", diff --git a/client/cs_apps.C b/client/cs_apps.C index 35291ee3b7..97fe102548 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -285,6 +285,10 @@ void CLIENT_STATE::assign_results_to_projects() { project = rp->project; if (project->next_runnable_result) continue; + // don't start results if > 2 uploads in progress + // + if (project->nactive_uploads > 2) continue; + project->next_runnable_result = rp; } @@ -554,10 +558,17 @@ bool CLIENT_STATE::schedule_cpus() { // for (i=0; inext_runnable_result = NULL; + projects[i]->nactive_uploads = 0; } for (i=0; ialready_selected = false; } + for (i=0; ifile_xfers.size(); i++) { + FILE_XFER* fxp = file_xfers->file_xfers[i]; + if (fxp->is_upload) { + fxp->fip->project->nactive_uploads++; + } + } set_scheduler_modes(); adjust_debts();