Skip to content

feat(dht): enhance performance and reliability with caching and adapt… #3224

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pranavkonde
Copy link

Description

Improves DHT performance and reliability with caching, adaptive timeouts, and better resource management.

Changes

  • Add record caching (LRU, 1000 entries, 5min TTL)
  • Implement adaptive timeouts based on peer response times
  • Add a peer scoring system for better peer selection
  • Add batched cleanup for stale provider records
  • Add comprehensive metrics for monitoring

New Metrics

  • Query timing and error metrics
  • Provider operation metrics
  • Cleanup performance metrics
  • Cache hit/miss rates

Performance Impact

  • Reduced query latency through caching
  • Better query success rates with adaptive timeouts
  • Improved resource utilization
  • Faster peer selection

Testing

  • Verified cache behavior and expiration
  • Tested adaptive timeout functionality
  • Confirmed peer scoring system
  • Checked metrics accuracy

@pranavkonde pranavkonde requested a review from a team as a code owner July 13, 2025 19:07
@achingbrain
Copy link
Member

Thank you for opening this PR.

Is this in response to an issue you’ve seen in a deployed application or are you just trying to make general improvements to the codebase?

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.

2 participants