Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Milestone: Refactor Go DHT codebases #32

Closed
@iand

Description

@iand

ETA: 2023-09-30

Description: Refactor the current Go DHT implementation to make it easier to maintain, more reliiable and provides a solid foundation for future extension and the Composable DHT.

Deliverable: a working but unoptimised DHT that can be used in Kubo without error. Performance and resource consumption should be no more than 10% (?) worse than current DHT implementation, with the expectation that better results will come with optimization.

Motivation:

  1. The codebase is very hard to understand and to modify. While trying to implement IPIP-373: Double Hash DHT Spec ipfs/specs#373, we figured that it would be more time-efficient to refactor/rewrite the implementation rather than trying to plug the changes in the existing implementation.
  2. Flaky tests due to concurrency issues. Unit tests evaluating if the implementation is working as expected are impossible to implement without a major refactor due to massive parallelization. Having a sequential Kademlia implementation would enable proper testing.
  3. Performance evaluation. For the reason above, it is hard to conduct performance evaluation tests. The current implementation is far from optimized from a resources POV, and it is likely the cause of Optimizing (or remove) the provider delay interval for DHT lookups used by Bitswap ipfs/kubo#8807, feat: set Bitswap.ProviderSearchDelay to 0s ipfs/kubo#9530, [Thunderdome Experiment Summary: provdelayrouting](https://www.notion.so/Thunderdome-Experiment-Summary-provdelayrouting-41b5807982c74938a9e6e15a3e38a7ad?pvs=21)). We cannot efficiently debug the current DHT implementation to find where the problem comes from. The outcome of feat: set Bitswap.ProviderSearchDelay to 0s ipfs/kubo#9530 is expected to have a high impact, as it could lead to a massive reduction in the Bitswap broadcast, but is depending on solving bugs in the DHT.
  4. Hard (or even impossible?) to test the protocol. IIUC Testground was built to help with testing the DHT, but hasn’t been (very) successful so far. Having a sequential DHT, using a fake clock would make protocol testing, evaluation and simulations much easier. So research and enhancements of the Kademlia protocol would become easier.
  5. Implementation mistakes. The current implementation contains multiple serious flaws that have been introduced over time. For instance, Kademlia should only handle Kademlia identifiers (256-bits bitstrings) internally, but it is currently using strings. A new start helps correcting all these fundamental issues, and allows us to apply the learnings gained over time.

More information in Notion

Children:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions