5 ms·
Funny, but Linux is the only unix-like OS I've ever run where using swap means you have a problem. Other OSes have much more intelligent memory management.
by feld 10y ago
Funny, but Linux is the only unix-like OS I've ever run where using swap means you have a problem. Other OSes have much more intelligent memory management.
- brianwawok 10y agoFor me swap is an error. I would rather a server crash then go into swap and run slow. If your servers are at 75% CPU and start swapping you are screwed. Time to start adding servers. In this day and age you are wasting a lot of money to be sitting around waiting for swap.
- fpoling 10y agozswap makes swap useful on the server as it results in gradual slowdown when the system has used all the ram. And if the system runs at 75% of CPU, then there is room for such slowdown.
- twic 10y agoI hadn't heard of zswap [0]: "Zswap is a lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. [...] Zswap is a new feature as of v3.11 [...] zswap is a work in progress and should be considered experimental." The return of RAM Doubler! The naming is initially confusing if you're already familiar with ZFS, especially: "Zswap makes use of zpool for the managing the compressed memory pool" [0] https://www.kernel.org/doc/Documentation/vm/zswap.txt https://www.kernel.org/doc/Documentation/vm/zswap.txt
- lmns 10y agoIt's actually quite useful on many consumer devices, especially those with multiple cores. Most of the time I'm happy I can trade a few CPU cycles for better I/O performance.
- mrmondo 10y agoyes, we run ZRAM of every single server we have, its fantastic and we don't have swap anywhere. It's worth noting though that vm.swappiness is set to 0 then ZRAM wont be used, it must be set to 1 or higher unless you're using a really old kernel (pre 3.5).
- mwpmaybe 10y agozram[0] is not the same thing as zswap[1]. 0. https://en.wikipedia.org/wiki/Zram https://en.wikipedia.org/wiki/Zram 1. https://en.wikipedia.org/wiki/Zswap https://en.wikipedia.org/wiki/Zswap
- fpoling 10y agoI have found that zswap behaves much better than zram when the size of the used ram approaches 150% of RAM. In theory zram compresses better as zswap has very simple mapping for the location of its cache of compressed pages leading to space underutilization. But, as it has real backing store, it can evict unused pages allowing bigger chunk of uncompressed memory for running applications.
- swiley 10y agoMy laptop has 8 gigabytes of ram. I can fit all of my personal files in that at obce, I don't see why that's not enough for everything.
- mrmondo 10y agoheh, try using Windows when it goes into swap, Windows both desktop and server additions have the worst memory management I've ever seen and having no ZRAM and a pig of a filesystem like NTFS really doesn't help either. Going into swap in Linux isn't a problem, it's a symtom of a misconfigured / provisioned server or an unhanled application memory leak, other than that the other only things that should cause it is incorrectly configured use of shared / reserved memory. Disk based swap should pretty much always be disabled these days and ZRAM used to incresed efficiency.
- arthurfm 10y ago> having no ZRAM Windows 10 has had memory compression [1] for quite a while now. On the PC I am on at the moment with 100+ Chrome tabs open, I have 1.3GB compressed out of a total of 16GB. [1] http://www.thewindowsclub.com/memory-compression-in-windows-10 http://www.thewindowsclub.com/memory-compression-in-windows-...
- lima 10y agoWorks very well on Windows Server 2012 and saves massive amounts of money with some workloads.
- Amezarak 10y agoIncidentally, at least on Windows, you can save a ton of harddrive space by changing your swap settings - the default is crazy high, especially if you have lots of RAM.
- lima 10y agoIt's not the case on Linux either. Linux intelligently swaps out ununsed pages even if there's enough physical RAM (that is more useful as page cache).
- feld 10y agoI have FreeBSD systems that use gigs of swap with gigs of memory free. If you have a Linux system with that much swap usage it's usually about to crash (as it struggling under memory pressure) People should stop monitoring swap usage and start monitoring the amount of page in / page out IO.
- lima 10y agoNot true. I have plenty of Linux systems that use gigabytes of swap with 100+GB of free RAM. Monitoring swap usage doesn't make sense on either FreeBSD or Linux.