github semihalev/sdns v1.5.0

latest releases: v1.6.0, v1.5.3, v1.5.2...
3 months ago

What's Changed

Overview

SDNS v1.5.0 is a major release featuring comprehensive modernization, significant performance improvements, and new enterprise-grade features. This release marks a substantial upgrade with enhanced monitoring capabilities, improved caching mechanisms, and better operational visibility.

New Features

1. Domain Metrics with Prometheus Integration

  • Per-domain query metrics: Track query counts for individual domains
  • Prometheus integration: Export metrics in Prometheus format for monitoring
  • Smart filtering: Automatically filters out single-label domains (TLDs)
  • Configurable limits: Control maximum domains to track with domainmetricslimit
  • Auto-eviction: Low-count domains are automatically evicted to maintain performance
  • Configuration: Enable with domainmetrics = "on" in config

2. Dnstap Binary Logging Support

  • Full dnstap protocol implementation: Industry-standard binary DNS message logging
  • Unix socket support: Connect to dnstap collectors via Unix sockets
  • Auto-reconnection: Automatic reconnection on connection failures
  • Configurable logging: Choose to log queries, responses, or both
  • Buffered writes: Efficient buffering for high-throughput environments
  • 100% test coverage: Thoroughly tested implementation

3. TCP Connection Pooling with Keepalive

  • Persistent TCP connections: Reuse TCP connections to root and TLD servers
  • EDNS-Keepalive support: Properly implements RFC 7828 for connection persistence
  • Configurable timeouts: Separate timeouts for root (5s) and TLD servers (10s)
  • Connection pool management: Automatic cleanup and connection limiting
  • Significant latency reduction: Eliminates TCP handshake overhead for subsequent queries
  • Configuration: Enable with tcpkeepalive = true in config

4. High-Performance Caching System

  • New SyncUInt64Map: Generic high-performance map with atomic operations
  • Parallel nameserver lookups: Improved resolver performance with concurrent queries
  • Smart cache eviction: Random bucket sampling for efficient eviction
  • Separate positive/negative caches: Better cache management and hit rates
  • Prefetch queue improvements: More efficient DNS prefetching

Performance Improvements

Benchmark Results (June 2025)

  • Query throughput: 709 QPS (24% improvement from v1.3.3's 571 QPS)
  • Average latency: 137ms (significantly faster than previous versions)
  • Lost queries: Only 2 out of 50,000 (99.996% success rate)
  • Runtime: 70.5s for 50,000 queries (19% faster than v1.3.3's 87.5s)
  • Cache hit rate: Significantly improved with new caching architecture
  • Memory efficiency: Better memory utilization with optimized data structures

Key Optimizations

  • TCP Connection Pooling: Eliminates repeated TCP handshakes to authoritative servers
  • Parallel nameserver lookups for faster resolution
  • Lock-free data structures with atomic operations
  • Efficient random sampling for cache eviction (avoiding O(n) iterations)
  • Migrated to golang.org/x/sync/singleflight for deduplication

Code Modernization

Go 1.23 Compatibility

  • Updated to Go 1.23 with modern patterns
  • Proper error wrapping with %w format
  • Use of strings.Cut for string operations
  • HTTP clients with proper timeouts
  • Modern test patterns and benchmarks

Improved Code Quality

  • Test coverage: Significantly improved across all packages
  • Race condition fixes: Resolved multiple race conditions
  • Linting: Updated to latest golangci-lint with comprehensive checks
  • Documentation: Enhanced inline documentation and configuration comments

Configuration Enhancements

New Configuration Options

# TCP Connection Pooling
tcpkeepalive = true               # Enable TCP connection pooling
roottcptimeout = "5s"             # TCP idle timeout for root servers
tldtcptimeout = "10s"             # TCP idle timeout for TLD servers
tcpmaxconnections = 100           # Maximum pooled TCP connections

# Domain metrics configuration
domainmetrics = "on"              # Enable domain metrics
domainmetricslimit = 10000        # Maximum domains to track

# Dnstap configuration  
dnstap = "on"                     # Enable dnstap logging
dnstappath = "/tmp/dnstap.sock"   # Unix socket path
dnstapidentity = "sdns"           # Server identity
dnstapversion = "1.5.0"           # Server version

Configuration File Improvements

  • Detailed inline documentation for all options
  • Better organization and grouping
  • Validation with helpful error messages
  • Config test coverage improved from 77.8% to 90.0%

Bug Fixes

  • Fixed race conditions in resolver's parallel lookup
  • Fixed race condition in blocklist's timesSeen map
  • Fixed root priming issues
  • Improved error handling throughout the codebase
  • Fixed Windows path handling in tests

Upgrading to v1.5.0

No Breaking Changes

All changes in v1.5.0 are backward compatible. Existing configurations will continue to work without modification.

Recommended Actions

  1. Review new configuration options (domain metrics, dnstap)
  2. Update monitoring to utilize new Prometheus metrics
  3. Consider enabling dnstap for comprehensive DNS logging
  4. Test in staging environment before production deployment

Performance Tuning

  • Adjust domainmetricslimit based on your traffic patterns
  • Configure cache sizes based on available memory
  • Enable prefetching for frequently accessed domains

Dependencies Updated

  • golang.org/x/net: v0.31.0 → v0.33.0
  • golang.org/x/sync: Added for singleflight implementation
  • golangci-lint: Updated to v1.62.2
  • Various other dependency updates for security and performance

Contributors

Special thanks to @semihalev (Yasar Alev) for leading this major release with comprehensive improvements across the entire codebase.

What's Next

  • Continued performance optimizations
  • Additional monitoring capabilities
  • Enhanced DNSSEC validation
  • Improved documentation and examples

For detailed changes, see PR #375.

Don't miss a new sdns release

NewReleases is sending notifications on new releases.