Skip to content

topicindex: renew expired registrations (demote to Standby) instead of dropping — avoid rediscovery round-trip, keep tables full #77

Description

@srene

Summary

When a registration's ad reaches its TTL, Registration.Update currently deletes the attempt (removeAttempt(att, "expired")). The registrar is still a valid candidate, but to register with it again the node must first rediscover it — via a discv5 random lookup, or as a node returned during another registration/search — before it can re-register.

Impact — an optimization, not a hard cap

This is not a hard cap on fan-out. In a healthy network with periodic DHT random lookups active, the registrar is rediscovered, so dropping-on-expiry mainly adds:

  • extra latency / work for the rediscovery round-trip before re-registration, and
  • transient under-fill of the registration table between expiry and rediscovery.

The effect is most pronounced when periodic random lookups are not active (or sparse): the expired candidate may not be rediscovered promptly, so registration tables stay under-filled and effective fan-out drops.

Proposed improvement

On expiry, demote the attempt back to Standby (clearing ticket / wait-time / request counters) so refillAttempts can re-promote it for renewal immediately, without waiting for rediscovery. To keep the standby pool bounded, drop instead of demote only when the standby pool is already full (there are enough renewal candidates; count[Standby] stays within RegBucketStandbyLimit).

Evidence (with caveat)

In a 10k-node simnet without periodic random lookups, demote-on-expiry lifted registration visibility from ~45% to 100% and median per-registrant fan-out from 1 to ~45. That scenario amplifies the effect (no rediscovery is happening); in a network with active lookups the gain is smaller — mostly reduced rediscovery delay and steadier table occupancy.

Prototyped in PR #70 (with the gated drop-when-standby-full refinement). The PR is closed for now and may be revisited if registration-coverage or latency issues are observed at scale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions