#610 new enhancement

upload should take better advantage of existing shares

Reported by: warner Owned by: kevan
Priority: major Milestone: soon
Component: code-encoding Version: 1.2.0
Keywords: upload verify preservation performance space-efficiency servers-of-happiness Cc: tahoe-dev@…, tahoe-lafs.org@…
Launchpad Bug:

Description (last modified by markberger)

Our current upload process (which is nearly the oldest code in the entire tahoe tree) could be smarter in the presence of existing shares. If a file is uploaded in January, then a few dozen servers are added in February, then in March it is (for whatever reason) uploaded again, here's what currently happens:

  • peer selection comes up with a permuted list of servers, with the same partial ordering as the original list but with the new servers inserted in various pseudo-random places
  • each server in the list is asked, in turn, if they would be willing to hold on to the next sequentially numbered share
  • each server might say yes or no. In addition, each server will return a list of shares that they might already have
  • the client never asks a server to accept a share that it already had a home for, but it also never unasks a server to hold a share that it later learns is housed somewhere else

So, if the client queries a server which already has a share, that server will probably end up with two shares. In addition, many shares will probably end up being sent to a new server even though some other server (later in the permuted list) already has a copy.

To fix this, the upload process needs to do more work:

  • it needs to cancel share-upload requests if it later learns that some other server already has that particular share
    • perhaps it should perform some sort of validation on the claimed already-uploaded share
  • if it detects any evidence of pre-existing shares, it should put more energy into finding additional ones
  • it needs to ask more servers than it strictly needs (for upload purposes) to increase the chance that it can detect this evidence

We're planning an overhaul of immutable upload/download code, both to improve parallelism and to replace the DeferredList with a state machine (to make it easier to bypass stalled servers, for example). These goals should be included in that work.

This process will work best when the shares are closer to the beginning of the permuted list. A "share rebalancing" mechanism should be created to gradually move shares in this direction over time. This is another facet of repair: no only should there be enough shares in existence, but they should be located in the best place for a downloader to find them quickly.

Change History (17)

comment:1 Changed at 2009-02-09T18:23:34Z by zooko

  • Cc tahoe-dev@… added

I'm going to add Cc: tahoe-dev to this ticket, and then I'm going to post the original contents of this ticket to tahoe-dev along with a link to this ticket.

comment:2 Changed at 2009-02-11T19:17:39Z by warner

Zandr suggested a simple "good enough" solution for 1.3.1:

  • at the end of peer selection, examine the list of (placed shares, found shares) for duplicates
  • for any placed share that was present in the list of found shares:
    • cancel the upload of that share
    • remove it from the 'landlords' list

This wouldn't be perfect, because there could be other pre-existing shares beyond the end of the portion of the permuted list that we wouldn't see, but it would at least remove some of the duplicated shares.

comment:3 Changed at 2009-06-30T12:40:36Z by zooko

  • Milestone changed from 1.5.0 to eventually

comment:4 Changed at 2009-08-10T15:29:29Z by zooko

The following clump of tickets might be of interest to people who are interested in this ticket: #711 (repair to different levels of M), #699 (optionally rebalance during repair or upload), #543 ('rebalancing manager'), #232 (Peer selection doesn't rebalance shares on overwrite of mutable file.), #678 (converge same file, same K, different M), #610 (upload should take better advantage of existing shares), #573 (Allow client to control which storage servers receive shares).

comment:5 Changed at 2009-08-10T15:45:50Z by zooko

Also related: #778 ("shares of happiness" is the wrong measure; "servers of happiness" is better).

comment:6 Changed at 2009-12-22T18:50:38Z by davidsarah

  • Keywords upload verify preservation added

comment:7 Changed at 2009-12-22T18:53:25Z by davidsarah

  • Keywords performance added

comment:8 Changed at 2009-12-22T18:55:58Z by davidsarah

  • Keywords space-efficiency added

comment:9 Changed at 2010-05-16T05:19:31Z by zooko

  • Milestone changed from eventually to 1.7.0
  • Owner set to kevan

This ticket was fixed by the patches that fixed #778. I think. Assigning this ticket to Kevan to verify and document that this ticket is fixed by his patches.

comment:10 Changed at 2010-05-16T18:00:27Z by kevan

I don't think #778 fixed this.

  • it needs to cancel share-upload requests if it later learns that some other server already has that particular share
    • perhaps it should perform some sort of validation on the claimed already-uploaded share

The bipartite matching wording of this issue is: "If it later learns that some other server already has that particular share, and it can use that share on that other server to create a maximum bipartite matching (or: a bipartite matching that is larger than the happiness threshold, though I'd take maximum reliability over the inefficiency of a duplicate share), it needs to cancel share-upload requests". #778 does not do this.

(I think this part of the issue would probably be better solved by the uploader rewrite alluded to at the end of #778; it isn't a regression compared to 1.6.1, and it would be a lot nicer if we considered this as one of the requirements to a new uploader than if we tried to graft it onto the existing uploader)

  • if it detects any evidence of pre-existing shares, it should put more energy into finding additional ones

#778 searches for pre-existing shares regardless of whether it has seen them, but only on (some of the) servers that it can't place them on. I think what this ticket suggests is to expand that search to peers that we can write to, and make that search triggered or otherwise conditional on finding pre-existing shares when issuing allocate_buckets() requests. #778 doesn't do that.

The read-only share discovery logic in #778 was implemented to solve the specific case of happiness being undercounted due to the fact that the upload process never contacted read only peers at all, and would therefore never know about the shares that they held. This ticket is more about doing that for *all* servers to maximize the efficiency of share placement on the grid. An easy first stab at that would be to expand the share discovery logic to work across all of the peers that it knows about, though that would add even more queries to the upload process.

  • it needs to ask more servers than it strictly needs (for upload purposes) to increase the chance that it can detect this evidence

#778 does do this -- it asks servers that it would not have asked in 1.6.1 to try to detect evidence of pre-existing shares.

comment:11 Changed at 2010-06-18T04:51:45Z by zooko

  • Milestone changed from 1.7.0 to soon

comment:12 Changed at 2011-07-22T13:30:22Z by zooko

Kevan: does your patch from #1382 affect this issue?

comment:13 Changed at 2012-03-29T22:45:19Z by davidsarah

  • Milestone changed from soon to 1.10.0

comment:14 Changed at 2013-02-15T03:54:46Z by davidsarah

This is likely to be fixed by implementing the algorithm in ticket:1130#comment:12, provided that it applies to upload as well as repair.

comment:15 Changed at 2013-07-09T17:52:58Z by markberger

  • Description modified (diff)

During 7/9/13's dev chat meeting, Brian suggested that the uploader contact 4n servers in the case where existing shares are found instead of the 2n used in ticket #1382. There was no decision made but we agreed that this ticket should be revisited once #1382 is closed and lands in trunk.

comment:16 Changed at 2013-07-16T15:41:19Z by zooko

  • Keywords servers-of-happiness added

comment:17 Changed at 2015-02-02T10:55:05Z by lpirl

  • Cc tahoe-lafs.org@… added
Note: See TracTickets for help on using tickets.