-
Notifications
You must be signed in to change notification settings - Fork 30
Alternative BitSwap strategies #20
Comments
@Arceliar thanks for the thoughts. i'll address a few points below. But either way, come hang out in #ipfs and help think about these things. important to note a few things first:
@Arceliar I'm curious about
Can you expand on this? I'm not seeing what you're seeing. Why is this "possibly the worst possible thing to do" -- discounting the hyperbole, this is still a strong claim that I'm not understanding. While the 10s delay is definitely a very poor simulation of rounds, it is a simulation of rounds. Please note it is very important to keep re-rolling (randomly chosing whether to send to someone else) periodically or decisions will stick too hard. The period here (whether to reroll per-round, or re-roll according to some other function) is important to the performance of the swarm, but I don't havestrong arguments nor meaningful data on what to chose. I'm sure thinking about it more will show functions that vastly outperform others in all the metrics we care about.
This is already accounted for in the trivial basic bitswap send probability. It is designed to tolerate leechers to a given threshold ratio (hence the logistic probability of sending). One important thing not accounted for in the DRAFT3 paper is that the debt ratio must be combined with the magnitude of the data transferred. (i.e. drastically different ratios when talking small (<5MB) dont matter much). (reminder to self: don't open the door wider for sybils.) |
Also, we'll soon be able to put these to the test! @Heems is making a bssim that we'll use to do basic bitswap simulations, and we'll expand that to run across real connections over real networks. We should make our own planet lab to test across the real internet. |
Thanks for the response @jbenet First off, I'm glad to hear about bssim. I'm too lazy to formally prove most of what I say, so I'm looking forward to playing with the sim to test. Secondly, it's entirely possible that I could be mistaken about the bitswap implementation in go-ipfs. I realize the specification in the paper doesn't include the 10s delay, but the go implementation is still the de-facto standard so I feel it warrants criticism when if I see an apparent issue. Feel free to correct me or point-and-laugh if I've made any mistakes in my arguments.
Using propshare's definition of "fair", you are of course completely right. I didn't think through my explanation very well in the IRC convo; I was mostly thinking about performance for users with low ratios when the sources of a block have unused bandwidth. Instead of dwelling on how to fix the thing I'm baselessly asserting is a problem, I'll just focus on describing the apparent issue the 10s delay before reroll causes, and I'll come back to potential workaround later. Let me start by illustrating with an example. Suppose that I have a website and I want to use ipfs to deliver any static files. This node is strictly a server, so it's not looking to download any blocks right now. Now suppose you visit my site and try to download a relatively large file--streaming a video, perhaps. I don't run a particularly popular site, so you're the first person to request this file, and I'm the only source of the blocks in the network at this time. I begin sending you blocks, but since there's nothing that I want from you, your ratio becomes poor. Eventually I fail a roll to send you a block, and this introduces a 10s delay. These delays get progressively more common as your ratio continues to fall, but I would still send the entire file to you given enough time (give or take any rounding or precision errors in the rolling function, and "enough time" might still be unreasonably long if the delays happen to aggressively). Now, if I'm not doing anything else with my bandwidth, what does introducing the delay accomplish? It seems like all I've done is degrade performance for you, by introducing a delay before sending blocks that I was going to have to send anyway. It would be better for the user if I had just sent the file via http as usual. A bittorrent seed does not normally stop sending data just because their peers' ratios are low. They might change who they send data to, depending on the clients seeding strategy, but they still endeavor to utilize as much available bandwidth as possible. That's really the crux of the issue that's bothering me. Looking at ratios, and using them to introducing delays, may have the effect of keeping things "fair" as measured by data sent, but it does at the cost of failing to utilize all available bandwidth at that moment in time. Bandwidth is the actual finite resource, so anything I fail to utilize is wasted from my perspective. So coming back to Propshare, I agree that it's fine to send data at a rate proportional to ratio (give or take the case where exactly 0 bytes have been sent), but only if renormalized to use all available bandwidth (that is, if someone isn't using their share of my bandwidth, I want to reallocate it fairly among the subset of peers for whom I have blocks to send). Most bittorrent clients manage to bypass this with optimistic unchoke, which helps keep things flowing in the rare cases where everyone's ratio is terrible w.r.t. the peers that have pieces they want. Or they just stop caring about ratios entirely once they become seeds. If my understanding of Bitswap's implementation is correct (big if), then it currently has no mechanism in place to mitigate the kinds of problems like in my example above. All that being said, I realize that actually implementing something that can utilize all available bandwidth is not trivial. A 10s delay is fine if it's just used until something better can be written, or to help with debugging, but it's still one of those things that keeps shouting in the back of my head that it needs to be fixed. |
@Arceliar I believe FairTorrent algorithm would solve those problems, it is generally better than PropShair. Though I do not know if FairTorrent can be implemented as a Bitswap strategy. |
There is room for more Bitswap strategies.
This one prefers the peer with the best debt ratio, while still seeding to peers with a worse ratio, if there is no better peer to seed to.
The text was updated successfully, but these errors were encountered: