- client: changed file upload logic

Old: each upload attempt consists of two HTTP requests:
        the 1st to get the current file size on server,
        the 2nd to upload the remainder of the file.
    Problem:
        a) if the upload server is overloaded and requests
            are succeeding with probability X,
            then the chance of both requests succeeding is X^2.
            So e.g. a per-request success rate of 0.1
            becomes an overall success rate of 0.01.
        b) the "get file size" request can be avoided in some cases.
    New:
        If we've already queried the file size
        and haven't uploaded any additional bytes,
        don't query the file size again.


svn path=/trunk/boinc/; revision=18605
This commit is contained in:
David Anderson 2009-07-16 19:41:56 +00:00
parent efc86c6b3a
commit 0f59eef9a7
2 changed files with 28 additions and 1 deletions

View File

@ -6303,3 +6303,23 @@ David 16 July 2009
lib/ lib/
gui_rpc_client_ops.cpp gui_rpc_client_ops.cpp
gui_rpc_client.h gui_rpc_client.h
David 16 July 2009
- client: changed file upload logic
Old: each upload attempt consists of two HTTP requests:
the 1st to get the current file size on server,
the 2nd to upload the remainder of the file.
Problem:
a) if the upload server is overloaded and requests
are succeeding with probability X,
then the chance of both requests succeeding is X^2.
So e.g. a per-request success rate of 0.1
becomes an overall success rate of 0.01.
b) the "get file size" request can be avoided in some cases.
New:
If we've already queried the file size
and haven't uploaded any additional bytes,
don't query the file size again.
client/
pers_file_xfer.cpp

View File

@ -191,7 +191,6 @@ bool PERS_FILE_XFER::poll() {
return false; return false;
} }
last_time = gstate.now; last_time = gstate.now;
fip->upload_offset = -1;
retval = create_xfer(); retval = create_xfer();
return (retval == 0); return (retval == 0);
} }
@ -269,6 +268,14 @@ bool PERS_FILE_XFER::poll() {
transient_failure(fxp->file_xfer_retval); transient_failure(fxp->file_xfer_retval);
} }
// If we transferred any bytes, set upload_offset back to -1
// so that we'll query file size on next retry.
// Otherwise leave it as is, avoiding unnecessary size query.
//
if (fxp->bytes_xferred) {
fip->upload_offset = -1;
}
// fxp could have already been freed and zeroed above // fxp could have already been freed and zeroed above
// so check before trying to remove // so check before trying to remove
// //