You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your node must re-announce (reprovide) content periodically to keep it
1978
+
discoverable. The [`Provide.DHT.Interval`](#providedhtinterval) setting
1979
+
controls this timing, with the default ensuring records refresh well before
1980
+
expiration or negative churn effects kick in.
1981
+
1982
+
**Two provider systems:**
1983
+
1984
+
-**Sweep provider**: Divides the DHT keyspace into regions and systematically
1985
+
sweeps through them over the reprovide interval. This batches CIDs allocated
1986
+
to the same DHT servers, dramatically reducing the number of DHT lookups and
1987
+
PUTs needed. Spreads work evenly over time with predictable resource usage.
1988
+
1989
+
-**Legacy provider**: Processes each CID individually with separate DHT
1990
+
lookups. Works well for small content collections but struggles to complete
1991
+
reprovide cycles when managing thousands of CIDs.
1992
+
1968
1993
#### Monitoring Provide Operations
1969
1994
1970
-
You can monitor the effectiveness of your provide configuration through metrics exposed at the Prometheus endpoint: `{Addresses.API}/debug/metrics/prometheus` (default: `http://127.0.0.1:5001/debug/metrics/prometheus`).
1995
+
**Quick command-line monitoring:** Use `ipfs provide stat` to view the current
1996
+
state of the provider system. For real-time monitoring, run
1997
+
`watch ipfs provide stat --all --compact` to see detailed statistics refreshed
1998
+
continuously in a 2-column layout.
1971
1999
1972
-
Different metrics are available depending on whether you use legacy mode (`SweepEnabled=false`) or sweep mode (`SweepEnabled=true`). See [Provide metrics documentation](https://github.com/ipfs/kubo/blob/master/docs/metrics.md#provide) for details.
2000
+
**Long-term monitoring:** For in-depth or long-term monitoring, metrics are
2001
+
exposed at the Prometheus endpoint: `{Addresses.API}/debug/metrics/prometheus`
2002
+
(default: `http://127.0.0.1:5001/debug/metrics/prometheus`). Different metrics
2003
+
are available depending on whether you use legacy mode (`SweepEnabled=false`) or
2004
+
sweep mode (`SweepEnabled=true`). See [Provide metrics documentation](https://github.com/ipfs/kubo/blob/master/docs/metrics.md#provide)
2005
+
for details.
1973
2006
1974
-
To enable detailed debug logging for both providers, set:
2007
+
**Debug logging:** For troubleshooting, enable detailed logging by setting:
Sets how often to re-announce content to the DHT. Provider records on Amino DHT
1986
-
expire after [`amino.DefaultProvideValidity`](https://github.com/libp2p/go-libp2p-kad-dht/blob/v0.34.0/amino/defaults.go#L40-L43),
1987
-
also known as Provider Record Expiration Interval.
2019
+
expire after [`amino.DefaultProvideValidity`](https://github.com/libp2p/go-libp2p-kad-dht/blob/v0.34.0/amino/defaults.go#L40-L43).
2020
+
2021
+
**Why this matters:** The interval must be shorter than the expiration window to
2022
+
ensure provider records refresh before they expire. The default value is
2023
+
approximately half of [`amino.DefaultProvideValidity`](https://github.com/libp2p/go-libp2p-kad-dht/blob/v0.34.0/amino/defaults.go#L40-L43),
2024
+
which accounts for network churn and ensures records stay alive without
2025
+
overwhelming the network with unnecessary announcements.
1988
2026
1989
-
An interval of about half the expiration window ensures provider records
1990
-
are refreshed well before they expire. This keeps your content continuously
1991
-
discoverable accounting for network churn without overwhelming the network with too frequent announcements.
2027
+
**With sweep mode enabled
2028
+
([`Provide.DHT.SweepEnabled`](#providedhtsweepenabled)):** The system spreads
2029
+
reprovide operations smoothly across this entire interval. Each keyspace region
2030
+
is reprovided at scheduled times throughout the period, ensuring announcements
2031
+
periodically happen every interval.
2032
+
2033
+
**With legacy mode:** The system attempts to reprovide all CIDs as quickly as
2034
+
possible at the start of each interval. If reproviding takes longer than this
2035
+
interval (common with large datasets), the next cycle is skipped and provider
2036
+
records may expire.
1992
2037
1993
2038
- If unset, it uses the implicit safe default.
1994
2039
- If set to the value `"0"` it will disable content reproviding to DHT.
@@ -2056,32 +2101,44 @@ Type: `optionalInteger` (non-negative; `0` means unlimited number of workers)
2056
2101
2057
2102
#### `Provide.DHT.SweepEnabled`
2058
2103
2059
-
Whether Provide Sweep is enabled. If not enabled, the legacy
2060
-
[`boxo/provider`](https://github.com/ipfs/boxo/tree/main/provider) is used for
2061
-
both provides and reprovides.
2062
-
2063
-
Provide Sweep is a resource efficient technique for advertising content to
2064
-
the Amino DHT swarm. The Provide Sweep module tracks the keys that should be periodically reprovided in
2065
-
the `Keystore`. It splits the keys into DHT keyspace regions by proximity (XOR
2066
-
distance), and schedules when reprovides should happen in order to spread the
2067
-
reprovide operation over time to avoid a spike in resource utilization. It
2068
-
basically sweeps the keyspace _from left to right_ over the
2069
-
[`Provide.DHT.Interval`](#providedhtinterval) time period, and reprovides keys
2070
-
matching to the visited keyspace region.
2071
-
2072
-
Provide Sweep aims at replacing the inefficient legacy `boxo/provider`
2073
-
module, and is currently opt-in. You can compare the effectiveness of sweep mode vs legacy mode by monitoring the appropriate metrics (see [Monitoring Provide Operations](#monitoring-provide-operations) above).
2074
-
2075
-
Whenever new keys should be advertised to the Amino DHT, `kubo` calls
2076
-
`StartProviding()`, triggering an initial `provide` operation for the given
2077
-
keys. The keys will be added to the `Keystore` tracking which keys should be
2078
-
reprovided and when they should be reprovided. Calling `StopProviding()`
2079
-
removes the keys from the `Keystore`. However, it is currently tricky for
2080
-
`kubo` to detect when a key should stop being advertised. Hence, `kubo` will
2081
-
periodically refresh the `Keystore` at each [`Provide.DHT.Interval`](#providedhtinterval)
2082
-
by providing it a channel of all the keys it is expected to contain according
2083
-
to the [`Provide.Strategy`](#providestrategy). During this operation,
2084
-
all keys in the `Keystore` are purged, and only the given ones remain scheduled.
2104
+
Enables the sweep provider for efficient content announcements. When disabled,
2105
+
the legacy [`boxo/provider`](https://github.com/ipfs/boxo/tree/main/provider) is
2106
+
used instead.
2107
+
2108
+
**The legacy provider problem:** The legacy system processes CIDs one at a
2109
+
time, requiring a separate DHT lookup (10-20 seconds each) to find the 20
2110
+
closest peers for each CID. This sequential approach typically handles less
2111
+
than 10,000 CID over 22h ([`Provide.DHT.Interval`](#providedhtinterval)). If
2112
+
your node has more CIDs than can be reprovided within
2113
+
[`Provide.DHT.Interval`](#providedhtinterval), provider records start expiring
> Sweep mode provides similar effectiveness to Accelerated DHT but with steady resource usage - better for machines with limited CPU, memory, or network bandwidth.
2166
+
> Sweep mode achieves similar effectiveness to the Accelerated DHT client but with steady resource consumption.
2167
+
2168
+
You can compare the effectiveness of sweep mode vs legacy mode by monitoring the appropriate metrics (see [Monitoring Provide Operations](#monitoring-provide-operations) above).
2110
2169
2111
2170
> [!NOTE]
2112
2171
> This feature is opt-in for now, but will become the default in a future release.
0 commit comments