Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • Nice hack with docker! If you don't specifically want to run inside docker, you could also use a cgroup manually. systemd-run should be able to apply systemd.resource-control properties to any command (these are also implemented using cgroups). As a non-root user, you can use systemd-run --user Commented Jun 22, 2018 at 12:18
  • You are misunderstanding memory reports from the system. Pages used as cache are free memory. It's only used as cache until some process wants it. Basically that's the OS using spare memory to cache stuff. Dropping cached content does no good (that memory was already available). Worse, if any of the dropped data is needed, the system will have to fetch it again. Commented Aug 26, 2018 at 3:53
  • @spectras I know that very well, it does not change the fact that Linux tries to swap out memory because of low "free" memorey Commented Aug 27, 2018 at 11:48
  • It does not. It optimizes memory use, usually ahead of time. A frequently-used cache is much more useful than a page that was really allocated, but it was 20 days ago and the process never used it since. The aggressiveness of that optimization is controlled by the vm.swappiness setting, as dolapevich said in his answer. You can disable it entirely by setting it to 0. Commented Aug 27, 2018 at 13:41
  • @spectras I don't want to disable swappiness completely, I need it. My servers get a CPU spikes because of swapping out because of low "free" cache Commented Aug 27, 2018 at 13:53