On Aug 10, 2017, at 2:17 PM, John R Pierce <pie...@hogranch.com> wrote: > > On 8/10/2017 1:12 PM, Warren Young wrote: >> You want those pages to get swapped out quickly so that the precious RAM can >> be used more productively; by the buffer cache, if nothing else. > > most modern virtual memory OS's don't swap out unused pages, instead, they > swap IN accessed pages directly from the executable file. only thing written > to swap are 'dirty' pages that have been changed since loading.
Is that not a distinction without a difference in my case? Let’s say I have a system with 256 MB of free user-space RAM, and I have a binary that happens to be nearly 256 MB on disk, between the main executable and all the libraries it uses. Question: Can my program allocate any dynamic RAM? The OS’s VMM is free to use addresses beyond 0-256 MB, but since we’ve said there is no swap space, everything swapped in must still be assigned a place in physical RAM *somewhere*. Is there a meaningful distinction between: Scenario 1: The application’s first few executable pages are loaded from disk, a few key libraries are loaded, then the application does a dynamic memory allocation, then somehow causes all the rest of the executable pages to be loaded, running the system out of RAM. Scenario 2: The application is entirely loaded into RAM, nearly filling it, then the application attempts a large dynamic memory allocation, causing an OOM error. Regardless of the answer to these questions, I can tell you that switching that web site to a more efficient web application stack allowed us to shrink the VPS from a 256 MB plan, under which it would occasionally crash and require a reboot, to a 64 MB plan, under which the site has been rock-solid. Same VPS provider, same web site content, same user-facing functionality. If I’d had the ability to assign swap space, I probably could have gotten away with a 64 MB VPS plan with the inefficient web technology, too. They gave me plenty of disk space with that plan. (And no, swapon /some-file is no solution here. The VPS technology simply didn’t allow swap space, even from a swap file on one of the system disks. It wasn’t simply an inability to add a swap partition.) _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos