Reading memory evidence at the right boundary Why adding up worker RSS overcounts One worker becomes three, and the sum of the memory columns triples. Dev's service hasn't loaded three different catalogs. All three workers may be mapping the same resident pages. The sum of worker resident sizes rises from two hundred to six hundred mebibytes. If three workers map the same two-hundred-mebibyte region, each can report those pages in its own resident set. Adding the reports counts the region three times. Virtual size includes mapped ranges whether or not their pages are resident. RSS measures resident pages seen through one process. Shared library pages in context Summing RSS across workers counts a shared page repeatedly. Proportional set size divides shared pages among their mappings, while control group accounting measures the group’s charge under a different set of rules. A mapping list breaks a process down into anonymous regions, stacks and file-backed segments. Large mapped size alone does not show how many pages have been touched. Meminfo distinguishes several classes of memory, including file cache, dirty pages and reclaimable slab. Some fields overlap, so adding every line yields a meaningless total. Buffer and page caches serve kernel and file input and output. Some cached memory can be reclaimed. The cost depends on whether pages are clean, dirty or still actively used. Suppose three workers map the same ninety-megabyte library, and each owns ten megabytes privately. If all pages are resident, adding their resident set sizes counts the shared library three times. A proportional view attributes roughly thirty megabytes of the shared pages to each worker in this example. Count a shared page once Separate file-backed segments, stack and heap in one process. PSS apportions shared pages while RSS counts each resident mapping. Compare process-private growth with group memory and memory pressure. A second equivalent interval helps separate object growth from worker-count changes. A large file cache can be useful while free memory remains small. If a reader repeatedly revisits the same data, that cache prevents storage reads. Reclaiming it may improve a free-memory number while hurting latency. Decide whether the real problem is lack of headroom, repeated reclaim, a local limit or private growth. Choose a measurement tied to the observed symptom. Read the measurements Now fork a worker and let the child modify a private mapped page. Copy on write can create a second physical page where both processes previously shared one. The mapping still has the same virtual address in the child. The physical ownership and proportional accounting have changed. Grouping by worker hides the fact that a shared library can be mapped by processes outside the group as well. Proportional estimates depend on actual sharing. To explain a container limit, reconcile the group accounting and associated kernel memory too. Process views and charge accounting legitimately describe different populations. Observe the first private write Does that guarantee the other two workers will always be nearly free? Watch a worker modify shared private mappings after a fork. Copy on write can turn a shared physical page into a private one. Compare proportional set size, private dirty memory and the workload's group charge over that interval. If private dirty pages and the group charge grow with tenant churn, investigate retained mutable data instead of shared mappings. Check the competing explanation A prefork service triples its worker count and the RSS sum jumps. Before buying RAM compare proportional and private dirty memory, node availability, control group usage and pressure. Similar shared mappings can account for most of the apparent growth. Repeat after workers mutate shared pages because copy-on-write can turn that apparent cost into real private memory. Choose an accounting view for the question After right-sizing the pool the example's summed resident reading is two hundred twenty mebibytes. Available memory estimates how much can be used without swapping under current conditions. Vmstat samples activity over time, including paging and runnable work. Compare interval rows rather than only a boot average. Dev labels it as a sum. The group charge and proportional views answer related questions without silently treating shared pages as distinct copies. Apply the diagnosis If physical memory pressure is rising, ask which pages are reclaimable and which group is charged. A single process report may omit kernel memory charged to its container. Read host and workload pressure beside private and shared growth. The sum of process sizes is a useful clue only after the overlap is understood.