You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
buffer_pool: split into read/write pools with proper backpressure
Split unified buffer pool into separate read and write pools to isolate
memory usage and enable better diagnostics:
- Read pool: 128 MB (8192 buffers) for async_read + async_hash
- Write pool: 256 MB (16384 buffers) for async_write
Implement proper backpressure mechanism:
- Use allocate_buffer(exceeded, observer) in async_write
- Return exceeded flag to trigger libtorrent backpressure
- When write pool exceeds high watermark (87.5%), libtorrent stops
sending more blocks until pool recovers to low watermark (50%)
- This prevents pool exhaustion and maintains stable memory usage
Clean up unified_cache API:
- Remove unused exceeded and observer parameters from insert_write()
- These parameters had no effect (watermark checking was disabled)
Update logging:
- Change buffer pool warnings to debug level to reduce log noise
- Add detailed pool usage statistics every 30 seconds
- Show separate READ/WRITE pool usage percentages
This addresses the write pool exhaustion issue observed at high download
speeds (700+ MB/s) where the pool would reach 100% and trigger sync write
fallbacks. With backpressure, usage stays between 50-87.5%.
Signed-off-by: Date Huang <tjjh89017@hotmail.com>