SShortSingh.
Back to feed

Go developer solves RAM exhaustion in video server using Linux FADV_DONTNEED syscall

0
·1 views

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.

Read the full story at DEV Community

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

Related stories

0
ProgrammingDEV Community ·

How to Build a Distress Signal Mechanism for Stuck AI Agents in Production

Production AI agents can silently fail by looping, retrying failed calls, or consuming resources while appearing to function normally from the outside. A proposed design pattern called an 'AI agent distress signal' gives agents a structured way to flag when they are blocked, uncertain, over budget, or about to take a risky action. The mechanism sits between detection and recovery controls, routing issues to a human operator or fallback system before a workflow wastes cost or trust. Developers are advised to define explicit trigger categories — such as missing permissions, conflicting data sources, and repeated tool failures — rather than relying on the model's own judgment. The goal is to provide production workflows with a reliable, auditable escape path when a task cannot be safely completed.

0
ProgrammingDEV Community ·

React Architecture Guide Explains How to Scale Large Frontend Applications

A tutorial published on DEV Community as part of a React Mastery Series outlines principles for architecting large-scale React applications, targeting senior frontend engineers and architects. The guide contrasts small apps with enterprise-level applications that may have over 1,000 components, 100+ pages, multiple teams, and millions of users. It introduces concepts such as high cohesion, low coupling, and clear domain boundaries to prevent features from becoming tightly interdependent. The tutorial recommends organizing code around business domains rather than technical file types, with each feature exposing only a public API via an index file. It also briefly introduces Clean Architecture, separating the UI, application, domain, and infrastructure layers for improved testability and scalability.

0
ProgrammingDEV Community ·

Build, Buy, or API: A Practical Framework for AI Capability Decisions

A software consultancy has outlined a three-gate framework for deciding whether to build, buy, or use an API for AI capabilities, evaluating each option on competitive differentiation, rate of change, and real-world cost at scale. Commodity capabilities such as text generation, transcription, and OCR are best served by hosted APIs from providers like OpenAI or Anthropic, which typically outperform small in-house teams from day one. Buying a dedicated third-party product makes sense when the required capability is a solved problem and maintaining it in-house would distract the team from core product work. Building in-house is justified only when the capability is a genuine differentiator, proprietary data meaningfully changes the outcome, or per-call API costs exceed a subscription at high volume. Regardless of the choice made, the firm recommends designing for flexibility by placing providers behind a switchable interface and monitoring costs closely, since the optimal decision can shift as volumes grow or vendor terms change.

0
ProgrammingDEV Community ·

How to Design MCP Tool Schemas That Prevent AI Agent Misuse

A software development analysis highlights that input validation alone is insufficient to prevent AI agents from misusing MCP server tools, as language models can send well-formed but semantically incorrect calls. Four recurring failure patterns are identified: selecting the wrong tool, passing valid-but-incorrect arguments, violating preconditions, and receiving unrecoverable errors. The author argues these are interface design flaws rather than validation bugs, and that the solution lies in constraining tool schemas at the design stage. Using real code from the Frihet MCP server, the piece demonstrates how replacing open string fields with enums and bounded numeric ranges eliminates entire categories of agent error. By making illegal states unrepresentable in the schema itself, developers can guide probabilistic AI callers toward correct behavior without relying on documentation.

Go developer solves RAM exhaustion in video server using Linux FADV_DONTNEED syscall · ShortSingh