Go developer solves RAM exhaustion in video server using Linux FADV_DONTNEED syscall
Engineers building RUSEON-core, a zero-copy video streaming server, discovered their 32 GB production server was nearly out of RAM within an hour of handling 100 camera streams. The culprit was Linux's OS page cache, which silently cached large volumes of fMP4 video archive data being written to disk. Common fixes like periodically running drop_caches or relying on the OOM killer were unsuitable for a fault-tolerant system. The team resolved the issue in Go by first calling Sync() to flush dirty pages to disk, then invoking the Fadvise syscall with the FADV_DONTNEED flag to instruct the kernel to release those cached pages. This 'write and forget' approach kept RAM usage in check without destabilising the server or requiring manual intervention.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in