Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New values for DHT Provider Record Republish and Expiration (22h/48h, RFM17) #451

Merged
merged 7 commits into from
Dec 12, 2022

Conversation

yiannisbot
Copy link
Contributor

@yiannisbot yiannisbot commented Sep 14, 2022

This PR updates the description of the Provider Record settings and most importantly proposes new values for both the republish interval and the expiration interval. The new proposed values are:

  • republish interval to be set to 22hrs, from its current 12hrs
  • expiration interval to be set to 48hrs, from its current

and they are based on the comprehensive study published here: https://github.com/protocol/network-measurements/blob/master/results/rfm17-provider-record-liveness.md

@yiannisbot yiannisbot changed the title Provider Record Settings Description New value proposal for Provider Record settings Sep 14, 2022
@lidel lidel requested review from mxinden and raulk September 14, 2022 14:28
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping Republish and Expiration sounds sensible ("reduce the overhead without interfering with the performance and reliability").

@mxinden any concerns from non-IPFS side of things?

kad-dht/README.md Outdated Show resolved Hide resolved
kad-dht/README.md Outdated Show resolved Hide resolved
kad-dht/README.md Outdated Show resolved Hide resolved
yiannisbot and others added 3 commits September 15, 2022 05:43
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful to see these optimizations based on comprehensive studies!

Can you bump the revision of the specification at the top of the document?

kad-dht/README.md Outdated Show resolved Hide resolved
kad-dht/README.md Show resolved Hide resolved
kad-dht/README.md Outdated Show resolved Hide resolved
Comment on lines 314 to 319
to prevent storing potentially outdated address information. Implementations that choose
to keep the network address (i.e., the `multiaddress`) of the providing peer should do it for **the
first 10 mins** after the provider record (re-)publication. The setting of 10 mins follows
the DHT Routing Table refresh interval. After that, peers provide
the provider's `peerID` only, in order to avoid pointing to stale network addresses
(i.e., the case where the peer has moved to a new network address).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, this is the status quo in the Golang implementation, correct? Is there any data backing up this decision? What I am surprised by is that addresses go stale so quickly. Is that really the case on IPFS today?

Copy link
Contributor Author

@yiannisbot yiannisbot Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the status quo in the Golang implementation, correct?

Yup.

Is there any data backing up this decision?

Nope :) But plan to start some investigation asap. See: ipfs/kubo#9264, protocol/prodeng#22 and probe-lab/thunderdome#91 as an optimisation.

What I am surprised by is that addresses go stale so quickly. Is that really the case on IPFS today?

Given that IPFS DHT servers have public addresses, I doubt that they go stale so quickly. This might change when hole punching is widespread, but the optimisation proposed in the above issues won't hurt, I believe :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we are not sure this optimization is a good idea, how about only documenting it in this specification once we know it is a good idea?

Otherwise new implementations like Iroh (//CC @dignifiedquire) would have to implement this despite not being an optimization in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, we've figured out that this has changed to 30mins: libp2p/go-libp2p@c282179 - I've rephrased the text accordingly to make it more generic and mention this value for the kubo implementation.

There's also this: ipfs/kubo#9264 - any views more than welcome! :)

kad-dht/README.md Outdated Show resolved Hide resolved
Comment on lines 275 to 276
and nodes that store and serve provider records need to make sure that the Multihashes whose
records they store are still served by the content provider.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do they do this? Is this happening today on the IPFS DHT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done (somewhat indirectly) through the expiration of the provider record: if the content provider does not republish the record (within the republish interval), then nodes do not serve those provider records after the expiration interval (assuming that the content provider is not interested having this content live anymore).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above phrasing implies this being an active process on the provider record storage node. What do you think of rephrasing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've rephrased to the following - let me know if it reads better:

"Content needs to be reachable, despite peer churn;
and nodes that store and serve provider records should not serve records for stale content,
i.e., content that the original provider does not wish to make available anymore."

remain online when clients ask for the record. In order to
guarantee this, while taking into account the peer churn, content providers
republish the records they want to provide every 24 hours.
2. **Provider Record Expiration Interval (48hrs):** The network needs to provide
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be harmonized with the PUT_VALUE expiration time as well, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yiannisbot while we're changing the times any reason not to do this too? Seems like it'd be reasonable since expiration is based on the same properties. It'd also make things easier to reason about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean in the PR? Yes, the intention is to change both the republish and the expiration interval. Otherwise it would make no sense (or well, it would be confusing). Or do you mean something else?

cc: @cortze who is working to submit the relevant PR.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with changing them together. However, unless I am missing something in the code, they will have to be two separate PRs:

  1. Update kubo's default Reprovider.Interval here
  2. Update go-libp2p-kad-dht's ProvideValidity here

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking here the PR libp2p/go-libp2p-kad-dht#793 to increase the expiration time of the PRs to 48h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean in the PR

No, I mean to change the expiration time for PUT_VALUE records in addition to ADD_PROVIDER records.

i.e. for the IPFS Public DHT the expiration time for PUT_VALUE (i.e. IPNS and the deprecated public key records) is 36hrs
https://github.com/libp2p/go-libp2p-kad-dht/blob/dae5a9a5bd9c7cc8cfb5073c711bc308efad0ada/internal/config/config.go#L117. It seems like this could be 48hrs as well rather than 36.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cortze should we change that too then? It makes sense. Do you want to create the PR and set it to 48hrs?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just created it! here is the link to the PR -> go-libp2p-kad-dht#794

kad-dht/README.md Outdated Show resolved Hide resolved
kad-dht/README.md Show resolved Hide resolved
Comment on lines 281 to 283
remain online when clients ask for the record. In order to
guarantee this, while taking into account the peer churn, content providers
republish the records they want to provide every 24 hours.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this has already been considered, but given this is an implicit protocol change it might help implementers to know what they should use as the republish interval. 24hrs matches the current expiration time so reproviding every 24hrs while the network is (slowly) upgrading might not be great. Perhaps it's fine in networks like the IPFS Public DHT since some nodes will upgrade quickly (e.g. Hydras, people autodeploying the latest kubo Docker containers, etc.) but just wanted to flag this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so you suggest not having the new republish interval the same as the old expiration interval as this will become confusing and might have side effects as well? I guess a valid workaround is to have the republish interval set to something a bit smaller (say, 20hrs?) for the transition period? Any better approaches?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set this to 22hrs. @mxinden @aschmahmann let me know if that works for you.

kad-dht/README.md Show resolved Hide resolved
kad-dht/README.md Outdated Show resolved Hide resolved
@yiannisbot
Copy link
Contributor Author

@lidel @mxinden @aschmahmann I've addressed all comments, apart from the one suggesting to have the PR on IPFS before merge this. Can you have another look to see if everything is ready? In the meantime, we'll work to get the PR ready on the IPFS side of things - feel free to do so as well if you wish :)

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-ups @yiannisbot.

Other than the specification revision bump and the kubo pull request, this looks good to me.

Comment on lines +313 to +321
It is also worth noting that the keys for provider records are multihashes. This
is because:

- Provider records are used as a rendezvous point for all the parties who have
advertised that they store some piece of content.
- The same multihash can be in different CIDs (e.g. CIDv0 vs CIDv1 of a SHA-256 dag-pb object,
or the same multihash but with different codecs such as dag-pb vs raw).
- Therefore, the rendezvous point should converge on the minimal thing everyone agrees on,
which is the multihash, not the CID.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@yiannisbot
Copy link
Contributor Author

Here is the PR to change the republish interval in kubo: ipfs/kubo#9326
The expiration interval change is coming soon.

@cortze
Copy link

cortze commented Oct 5, 2022

Here is the second PR libp2p/go-libp2p-kad-dht#793 to increase the expiration time of the PRs from 24h to 48h.

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxinden @marten-seemann bumped revision in the header, mind giving this final review?

Kubo team wants to ship and with next Kubo 0.18 release, but want to make sure we have specs merged first

fwiw I've updated revision as requested, and made it easier to find/eyeball both numbers:

2022-12-09_00-06

@Stebalien
Copy link
Member

Heil Hydra, I guess. If the records are staying around that long, we should do this.

@lidel lidel changed the title New value proposal for Provider Record settings New values for DHT Provider Record Republish and Expiration (22h/48h, RFM17) Dec 11, 2022
@lidel
Copy link
Member

lidel commented Dec 11, 2022

There is also a general DX/UX improvement that comes with raising the ceiling of expiration.

Trying to keep IPNS website alive with spotty internet access is tricky.
It is not hard to imagine a situation when the publisher of an IPNS record can't be online exactly every 24h (living on a boat, or having to visit a library/school to access internet).
Expiration set to 48h makes a more “humane” default (“publish once a day, exact hour does not matter”).


In effort to include this in Kubo 0.18.0-rc1 before holidays, I've released go-libp2p-kad-dht v0.20.0 with 48h expiration.
Kubo 0.18 will also have the default Republish Interval set to 22h (ipfs/kubo#9389), being fully compliant with the spec from this PR.

@mxinden

  1. should I open PR to adjust defaults in rust-libp2p/protocols/kad/src/behaviour.rs, or are there other places?
  2. ok to merge this PR?

@p-shahi
Copy link
Member

p-shahi commented Dec 11, 2022

Should we go ahead and update js-libp2p-kad-dht (and js-ipfs' reprovide interval)?
cc: @achingbrain

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to everyone involved here.

@mxinden
Copy link
Member

mxinden commented Dec 12, 2022

@mxinden

1. should I open PR to adjust defaults in [rust-libp2p/protocols/kad/src/behaviour.rs](https://github.com/libp2p/rust-libp2p/blob/4fe518de86ecb0805421cca6e291db168c10eac1/protocols/kad/src/behaviour.rs#L182-L196), or are there other places?

2. ok to merge this PR?

Tracked here libp2p/rust-libp2p#3229. Contributions are always welcome. That said, not a requirement to move forward here. Thanks for stewarding this @lidel.

lidel added a commit to libp2p/rust-libp2p that referenced this pull request Dec 12, 2022
Applies changes from libp2p/specs#451

New defaults are:
Record Expiration: 48h
Record Republish Interval: 22h

Closes #3229
@mxinden mxinden merged commit 9a646c0 into libp2p:master Dec 12, 2022
mergify bot pushed a commit to libp2p/rust-libp2p that referenced this pull request Mar 29, 2024
This patch applies changes from libp2p/specs#451. In particular, the new defaults are:

- Record Expiration: 48h
- Record Republish Interval: 22h

Closes #3229.

Pull-Request: #3230.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants