v0.6.0
Highlights
This release focuses on performance optimization and concurrency safety improvements, significantly enhancing throughput and stability under high-load scenarios.
⚠️ Breaking Changes
- Removed manual GC tuning configuration in
main.go, replaced with automatic tuning mode
✨ New Features
Connection Pool Optimization
- Implemented connection pool preheating to eliminate cold start delay
- Optimized pool scaling logic with burst load batch expansion support
- Concurrent data session creation to accelerate scaling
- Added ping loop keep-alive mechanism for each session
- Introduced
GetSessionStatsmethod for detailed session statistics
Tunnel Management & Security
- Implemented IP-based tunnel count and registration rate limits
- Added rate limiter to prevent malicious registration behavior
- Client IP address tracking for access control
Concurrency Safety Enhancement
- CAS loop implementation for atomic operations on global tunnel counter
- Added rollback mechanism to ensure proper resource release on registration failure
- Combined atomic operations with locks for thread-safe IP rate limiting
⚡ Performance Improvements
Core Performance
- Optimized session selection using min-heap, reducing time complexity from O(n) to O(log n)
- Added
bufio.Readerpool and buffer pool to reduce memory allocation - Implemented sharded lock manager for improved high-concurrency performance
- Updated yamux with unified optimized configuration for better throughput
- Added patterned GC tuning
HTTP Server
- Used
sync.Poolto reusebufio.Writer, reducing GC pressure - Enabled
TCP_NODELAYfor improved response speed - Adjusted HTTP server timeout configuration to balance performance and security
Resource Management
- Optimized stream open timeout control using context to prevent goroutine leaks
- Improved shutdown process to ensure proper cleanup coroutine exit
- Reduced maximum frame size from 10MB to 1MB to mitigate DoS risk
- Used stack arrays instead of heap allocation for frame header reading
🔧 Other Changes
- ID generator now exclusively uses
crypto/rand, removed timestamp fallback - Added
TryGenerateIDfor non-panic error handling - Upgraded test scripts from Python to Go implementation
- Added nginx WebSocket proxy header configuration documentation
Upgrade Guide
This release primarily contains performance optimizations. When upgrading:
- Remove any custom GC configuration code if present
- Thoroughly test in high-load environments before production deployment
Full Changelog: v0.5.3...v0.6.0
What's Changed
- Perf/pool scaling and latency fix by @Gouryella in #12
Full Changelog: v0.5.3...v0.6.0