github sockudo/sockudo v3.0.0
Sockudo v3.0.0

12 hours ago

Sockudo v3.0.0 - Major Release ๐Ÿš€

โš ๏ธ CRITICAL BREAKING CHANGES

Configuration Structure Changes

1. cluster_health Configuration Location Changed (BREAKING)

The cluster_health configuration has been moved from adapter.cluster_health to the top-level of the configuration.

Old location (v2.x):

{
  "adapter": {
    "cluster_health": {
      "enabled": true,
      "heartbeat_interval_ms": 10000,
      "node_timeout_ms": 30000,
      "cleanup_interval_ms": 10000
    }
  }
}

New location (v3.0.0):

{
  "cluster_health": {
    "enabled": true,
    "heartbeat_interval_ms": 10000,
    "node_timeout_ms": 30000,
    "cleanup_interval_ms": 10000
  }
}

Action Required: If you're using Redis, Redis Cluster, or NATS adapters with cluster health monitoring, you MUST move the cluster_health configuration to the top level. Failure to do so will cause the application to fail during startup.

2. New Optional Configuration Sections

The following new configuration sections have been added. These are optional and have sensible defaults:

  • websocket - WebSocket buffer management (optional, has defaults)
  • delta_compression - Delta compression settings (optional, disabled by default)
  • tag_filtering - Server-side tag filtering (optional, disabled by default)
  • unix_socket - Unix socket server (optional, disabled by default)

You do NOT need to add these sections if you're not using these features - they will use default values automatically.

3. Redis Configuration Cleanup

Empty redis_pub_options and redis_sub_options objects are no longer needed and should be removed from your configuration. Use the database.redis section for connection configuration instead.

Old (v2.x):

{
  "adapter": {
    "redis": {
      "redis_pub_options": {},
      "redis_sub_options": {}
    }
  }
}

New (v3.0.0):

{
  "adapter": {
    "redis": {
      "requests_timeout": 5000,
      "prefix": "sockudo_adapter:",
      "cluster_mode": false
    }
  },
  "database": {
    "redis": {
      "host": "your-redis-host",
      "port": 6379,
      "db": 0,
      "key_prefix": "sockudo:"
    }
  }
}

Migration Guide

  1. Move cluster_health configuration from adapter.cluster_health to top-level cluster_health
  2. Remove empty redis_pub_options and redis_sub_options if present
  3. Ensure database.redis section is properly configured for Redis connections
  4. Optional: Configure new features like delta_compression or tag_filtering if desired

Minimal Configuration Changes for Upgrade

If you're upgrading from v2.x, the minimum required change is:

{
-  "adapter": {
-    "cluster_health": {
-      "enabled": true,
-      "heartbeat_interval_ms": 10000,
-      "node_timeout_ms": 30000,
-      "cleanup_interval_ms": 10000
-    }
-  }
+  "cluster_health": {
+    "enabled": true,
+    "heartbeat_interval_ms": 10000,
+    "node_timeout_ms": 30000,
+    "cleanup_interval_ms": 10000
+  }
}

All other new sections (websocket, delta_compression, tag_filtering, unix_socket) are optional and will use default values if omitted.


Sockudo v3.0.0 - Major Release ๐Ÿš€

๐ŸŽ‰ Major Features

๐Ÿ”ฅ Delta Compression with Conflation Keys

A groundbreaking bandwidth optimization feature that reduces network usage by 60-90% for high-frequency updates.

Key Features:

  • Delta Compression: Send only message differences instead of full payloads
  • Conflation Keys: Group messages by entity (stock symbol, device ID, etc.) for maximum efficiency
  • Multiple Algorithms: Support for fossil (fast) and xdelta3 (high compression ratio)
  • Horizontal Scaling: Full support across Redis, Redis Cluster, and NATS adapters
  • Per-Channel Configuration: Granular control over compression settings
  • Automatic Encrypted Channel Detection: Automatically disables for private-encrypted-* channels
  • Client-Side Control: Opt-in/opt-out per subscription with algorithm negotiation

Performance:

  • 60-90% bandwidth savings for similar consecutive messages
  • ~5-20ฮผs CPU overhead per message
  • ~10-50KB memory per socket
  • Full message intervals for late subscribers

Documentation: See DELTA_COMPRESSION.md and extensive docs in docs/DELTA_COMPRESSION_*.md

๐Ÿท๏ธ Publication Filtering by Tags (Server-Side Filtering)

Intelligent server-side filtering that reduces bandwidth by only sending relevant messages to subscribers.

Key Features:

  • Zero-Allocation Filtering: 12-94ns per filter evaluation in broadcast path
  • Rich Filter Operators: eq, neq, gt, gte, lt, lte, and, or, not, in
  • Pusher-Compatible: Disabled by default for backward compatibility
  • Per-Channel Configuration: Clients can subscribe with custom filters
  • Bandwidth Optimization: Option to strip tags from messages globally or per-channel

Performance:

  • 10k subscriber broadcast: 112-924ฮผs with zero allocations
  • 60-90% bandwidth savings for filtered channels

Documentation: See docs/TAG_FILTERING.md and docs/TAG_FILTERING_QUICKSTART.md

๐Ÿ›ก๏ธ Redis Sentinel Support

High availability support for Redis deployments with automatic master discovery and failover.

Key Features:

  • Automatic master node discovery via Sentinel protocol
  • Seamless failover handling
  • Optional Sentinel authentication
  • Configuration via config file or environment variables

Configuration Example:

{
  "database": {
    "redis": {
      "sentinels": [
        { "host": "sentinel1.example.com", "port": 26379 },
        { "host": "sentinel2.example.com", "port": 26379 }
      ],
      "name": "mymaster",
      "sentinel_password": "optional",
      "password": "optional-master-password"
    }
  }
}

๐Ÿ”ง Unified Redis Cluster Configuration

Simplified and consistent Redis Cluster configuration across all components (adapter, cache, queue, rate limiter).

Key Improvements:

  • Single use_connection_manager flag for connection pooling
  • Consistent configuration structure across all Redis Cluster components
  • Better error handling and connection management
  • Improved performance with connection pooling

๐Ÿ“ฆ Cache Fallback Resilience

Automatic fallback to memory cache when Redis becomes unavailable, with intelligent recovery.

Key Features:

  • Automatic detection of Redis failures
  • Seamless fallback to in-memory cache
  • Background health checks and automatic recovery
  • Optional startup health check to avoid first-operation latency
  • Configurable recovery intervals and retry policies
  • Thread-safe recovery without blocking operations

Benefits:

  • Zero downtime during Redis outages
  • Graceful degradation under load
  • Automatic recovery when Redis comes back online

๐Ÿ”ง Enhancements

Performance Improvements

  • SocketId Refactor: Removed Arc<RwLock<>> wrapper around SocketId for better performance
  • ConnectionManager Optimization: Changed from &mut self to &self for concurrent access
  • sockudo_ws Migration: Replaced fastwebsockets with custom sockudo_ws crate for better control and performance
  • sonic-rs Integration: Replaced serde_json with sonic-rs for significantly faster JSON parsing and serialization
  • Zero-Allocation Broadcast: Optimized broadcast path with minimal allocations
  • WebSocket Buffer Management: Bounded buffers to prevent memory exhaustion from slow consumers

WebSocket Library Replacement: fastwebsockets โ†’ sockudo_ws

We've migrated from fastwebsockets to our custom sockudo_ws crate, providing:

  • Better Performance: Optimized for Sockudo's specific use cases
  • Enhanced Control: Full control over WebSocket frame handling
  • Improved Debugging: Better error messages and diagnostics
  • Custom Features: Tailored features for real-time messaging needs
  • Reduced Dependencies: Smaller dependency tree

JSON Library Replacement: serde_json โ†’ sonic-rs

Replaced serde_json with sonic-rs for substantial performance gains:

  • Faster Parsing: Up to 2-3x faster JSON deserialization
  • Faster Serialization: Up to 2-5x faster JSON serialization
  • SIMD Optimizations: Leverages modern CPU instructions
  • Lower Memory Usage: More efficient memory allocation patterns
  • Drop-in Replacement: Minimal code changes required

Performance Impact:

  • Message parsing: 40-60% faster
  • Broadcast serialization: 50-70% faster
  • Overall throughput: 20-30% improvement in high-traffic scenarios

WebSocket Buffer Management

Three Limit Modes:

  1. Message count only (default, fastest) - No size tracking overhead
  2. Byte size only - Precise memory control
  3. Both limits - Whichever triggers first

Configuration:

WEBSOCKET_MAX_MESSAGES=1000
WEBSOCKET_MAX_BYTES=1048576  # 1MB
WEBSOCKET_DISCONNECT_ON_BUFFER_FULL=true

DynamoDB App Manager Caching

  • Added Redis caching support for DynamoDB App Manager
  • Reduces DynamoDB read costs and latency
  • Configurable cache TTL and invalidation

Environment Variable Standardization

  • Unified environment variables to use _USERNAME suffix (e.g., DATABASE_REDIS_USERNAME)
  • More consistent configuration loading across components

๐Ÿ› Bug Fixes

Critical Fixes

  • WebSocket Close Codes: Fixed incorrect close codes to match Pusher protocol specification
  • Musl Binary Builds: Fixed Alpine container compatibility for musl binaries
  • Rate Limiting: Added independent rate limit flags and reliable distributed channel counting
  • SQS Queue Driver: Restored support for AWS SQS queue backend
  • IPv6 Sentinel Parsing: Fixed parsing issues with IPv6 addresses in Sentinel configuration

Test Improvements

  • Fixed flaky tests in WebSocket connection handling
  • Added comprehensive test suite for cache fallback resilience
  • Added delta compression integration tests
  • Added tag filtering benchmark suite
  • Moved tests from test/ to standard tests/ directory

Clippy and Formatting

  • Resolved all clippy warnings across all feature flags
  • Applied consistent formatting across the codebase
  • Fixed unused import warnings when features are disabled

๐Ÿ”’ Security Updates

Dependency Updates

  • bytes: 1.10.1 โ†’ 1.11.1 (security advisory fixes)
  • time: 0.3.43 โ†’ 0.3.47 (security advisory fixes)
  • redis: Updated to 1.0.0-rc.3 with improved security

Security Advisories Addressed

๐Ÿ“š Documentation

New Documentation

  • DELTA_COMPRESSION.md - Comprehensive delta compression guide
  • docs/DELTA_COMPRESSION_BANDWIDTH_OPTIMIZATION.md - Bandwidth optimization strategies
  • docs/DELTA_COMPRESSION_CLUSTER_COORDINATION.md - Cluster coordination details
  • docs/DELTA_COMPRESSION_HORIZONTAL_IMPLEMENTATION.md - Horizontal scaling implementation
  • docs/DELTA_COMPRESSION_LATE_SUBSCRIBERS.md - Late subscriber handling
  • docs/TAG_FILTERING.md - Complete tag filtering documentation
  • docs/TAG_FILTERING_QUICKSTART.md - Quick start guide for tag filtering
  • docs/CACHE_BACKENDS.md - Cache backend configuration guide

Updated Documentation

  • CLAUDE.md - Updated with all new features and configurations
  • README.md - Enhanced with v3.0.0 features and examples
  • .env.example - Added all new environment variables

๐Ÿงช Testing & Examples

New Examples

  • examples/client_delta_compression.js - Client-side delta compression example
  • examples/tag_filtering.rs - Server-side tag filtering example
  • examples/test_conflation.rs - Conflation keys demonstration
  • examples/xdelta_format_test.rs - xdelta3 format testing

Enhanced Test Suite

  • tests/interactive/ - Comprehensive interactive test suite with delta compression tests
  • tests/automated/delta-compression.test.js - Automated delta compression tests
  • tests/interactive/test-delta-decode.e2e.test.js - End-to-end delta decoding tests
  • tests/interactive/DELTA_COMPRESSION_TESTING.md - Delta compression testing guide
  • benches/delta_compression_bench.rs - Delta compression benchmarks
  • benches/filter_bench.rs - Tag filtering benchmarks

Benchmarking

  • benches/sender/ - Standalone Rust benchmark sender using pushers crate
  • benches/ci-horizontal.js - Horizontal scaling benchmark
  • benches/ci-local.js - Local benchmark suite

๐Ÿ”„ Breaking Changes

Configuration Changes

  • Test Directory: Moved from test/ to tests/ (standard Rust convention)
  • Redis Cluster Config: Unified configuration structure requires migration for existing Redis Cluster setups
  • Environment Variables: Standardized to _USERNAME suffix (old _USER still supported with deprecation warning)

API Changes

  • ConnectionManager Trait: Changed from &mut self to &self (affects custom implementations)
  • SocketId Type: Removed Arc<RwLock<>> wrapper (internal change, should not affect most users)

Dependency Changes

  • WebSocket Library: Migrated from fastwebsockets to sockudo_ws (internal change, no API changes)
  • JSON Library: Replaced serde_json with sonic-rs (internal change, fully compatible)

Migration Guide

  1. Update Redis Cluster configuration to use new unified structure
  2. Update environment variables to use _USERNAME suffix
  3. Rebuild tests if using custom test directory structure
  4. Review custom ConnectionManager implementations if any
  5. No changes needed for WebSocket or JSON changes (internal only)

๐Ÿ“ฆ Dependencies

Major Dependency Changes

  • Removed: fastwebsockets - replaced with custom sockudo_ws
  • Removed: serde_json - replaced with sonic-rs

Updated Dependencies

  • redis โ†’ 1.0.0-rc.3
  • bytes โ†’ 1.11.1
  • time โ†’ 0.3.47
  • sonic-rs โ†’ Added for faster JSON parsing (replaces serde_json)
  • xdelta3 โ†’ Added for delta compression

New Dependencies

  • sockudo_ws - Custom WebSocket implementation (replaces fastwebsockets)
  • fossil-delta - Fast binary delta compression
  • xdelta3 - VCDIFF (RFC 3284) delta compression

๐Ÿš€ Performance Metrics

Benchmark Results

  • Delta Compression: 60-90% bandwidth reduction for typical workloads
  • Tag Filtering: Zero-allocation filtering with 12-94ns per filter
  • Broadcast Performance: 10k subscribers in 112-924ฮผs
  • JSON Performance: 2-5x faster serialization, 2-3x faster parsing with sonic-rs
  • WebSocket Performance: 10-20% improvement with sockudo_ws
  • Memory Usage: ~10-50KB per socket with delta compression
  • CPU Overhead: ~5-20ฮผs per message for delta compression

๐Ÿ› ๏ธ Configuration

New Configuration Options

  • delta_compression.* - Delta compression settings
  • tag_filtering.* - Tag filtering settings
  • websocket.max_messages - WebSocket message buffer limit
  • websocket.max_bytes - WebSocket byte buffer limit
  • websocket.disconnect_on_buffer_full - Slow consumer behavior
  • database.redis.sentinels - Redis Sentinel configuration
  • cache.initial_health_check - Startup cache health check

New Environment Variables

  • TAG_FILTERING_ENABLED - Enable tag filtering globally
  • WEBSOCKET_MAX_MESSAGES - WebSocket message buffer limit
  • WEBSOCKET_MAX_BYTES - WebSocket byte buffer limit
  • WEBSOCKET_DISCONNECT_ON_BUFFER_FULL - Disconnect slow clients
  • DATABASE_REDIS_USERNAME - Redis username (ACL support)
  • Plus many more delta compression related variables

๐Ÿ“Š Statistics

  • 82 commits since v2.9.2
  • 211 files changed
  • 49,561 insertions
  • 5,713 deletions
  • 7 major features added
  • Multiple security advisories addressed
  • 2 major dependency replacements (fastwebsockets โ†’ sockudo_ws, serde_json โ†’ sonic-rs)

๐Ÿ™ Contributors

Special thanks to all contributors who made this release possible:

  • @lilfaf - DynamoDB caching and Redis improvements
  • @hzmifork - Environment variable standardization
  • And the entire Sockudo community for testing and feedback!

๐Ÿ“ Upgrade Notes

Recommended Steps

  1. Backup your configuration before upgrading
  2. Review breaking changes section above
  3. Update configuration files with new options
  4. Test delta compression in staging environment first
  5. Monitor performance after deployment
  6. Update client libraries to support new features

Feature Adoption

  • Delta Compression: Opt-in feature, disabled by default
  • Tag Filtering: Disabled by default for Pusher compatibility
  • Redis Sentinel: No changes required for existing Redis setups
  • Cache Fallback: Automatic, no configuration needed
  • sockudo_ws: Automatic, no changes needed
  • sonic-rs: Automatic, no changes needed

๐Ÿ”— Resources

  • Documentation: See DELTA_COMPRESSION.md, docs/TAG_FILTERING.md
  • Examples: Check examples/ directory
  • Tests: Explore tests/interactive/ for interactive testing
  • Benchmarks: Run benches/ for performance testing

๐ŸŽฏ What's Next?

Looking ahead to v3.1.0:

  • Further performance optimizations
  • Enhanced monitoring and observability
  • Additional compression algorithms
  • More filter operators and expressions
  • Continued performance improvements with sockudo_ws and sonic-rs

Full Changelog: v2.9.2...v3.0.0

Installation

Using cargo-binstall (Recommended)

cargo binstall sockudo --version 3.0.0

Using cargo

cargo install sockudo --version 3.0.0

Using Docker

docker pull ghcr.io/sockudo/sockudo:3.0.0
docker pull sockudo/sockudo:3.0.0

Direct Download

Download the appropriate binary for your platform from the assets below.

Platform Support

  • โœ… Linux x86_64 (GNU)
  • โœ… Linux x86_64 (musl)
  • โœ… Linux ARM64 (GNU)
  • โœ… Linux ARM64 (musl)
  • โœ… macOS x86_64 (Intel)
  • โœ… macOS ARM64 (Apple Silicon)
  • โœ… Windows x86_64
  • โœ… Docker linux/amd64
  • โœ… Docker linux/arm64

What's Changed

  • Delta compression, tag filtering, sockudo_ws integration, and benchmark sender by @countradooku in #171

Full Changelog: https://github.com/sockudo/sockudo/commits/v3.0.0

Don't miss a new sockudo release

NewReleases is sending notifications on new releases.