On 05/02/17 00:12, Rich Freeman wrote:
> On Sat, Feb 4, 2017 at 10:32 AM, Alan McKinnon <[email protected]>
> wrote:
>>
>> Size of swap is the classic cargo-cult question,
>
> ++
>
>>
>> Modern kernels DO get nervous if they have no swap at all - it's used
>> internally. So make a small amount of swap to make the kernel happy, say
>> 64M or so. Yes, megs.
>>
>
> So, uh, I'd be interested in some kind of citation for this, mainly
> because it also sounds a bit like cargo cult advice. :)
>
> What exactly doesn't work without swap, because I've been running
> without it for years?
>
The original 2x size was because very old unix systems when they crash
dumped use swap as the crash device. Further a crash dump back then
included a 1 to 1 dump of ram, hence the size. A Solaris web page I
just looked at mentions swap as the "dump device". Not sure when if
ever this applied to Linux in that context.
Things where you need a lot of swap:
hibernate if you use the swap device to hibernate - you need enough room
for your normal swap content and the image
Graphics - holding very large images in ram
special cases
I am currently using SSD's for swap (MS surface 4, intel ssd's and
samsung ssd's) as well as an apple air for 2 years I no longer use.
My oldest was used for ceph for 12 months before re-purposing as a
server OS, swap and bcache - performance was average and best you could
say was it was faster than spinning rust.
Current I have two systems with a OS+swap on one ssd and a btrfs raid10
on bcache on ssd - one backed with 4xDW reds, and the other with 4x WD
greens.
No failures yet - the majority of the HDD drives were part of LVM
volumes in the past and the current systems have "evolved" rather than
being bought for a carefully planned system.
I dont think that SSD age is really relevant for modern uses (though in
bulk buys I seen quite high early failure rates but that settled down
quickly.
I currently use:
vm.swappiness=1
vm.vfs_cache_pressure=50
and
olympus ~ # free -h
total used free shared buff/cache
available
Mem: 31G 30G 549M 216K 285M
609M
Swap: 23G 16G 8.0G
olympus ~ #