On 2017-09-18 19:56, John Andersen wrote:
On 09/18/2017 06:23 AM, Carlos E. R. wrote:
Another few points to consider Carlos:
Sometimes you think you are using swap, but you check and find out that the machine is set up by default to resist swapping until it gets desperate for memory. This has been the trend lately but it is a silly default when you have swap on an SSD.
I'm currently running 42.2 on a laptop limited to 4gig. I crank up the swappiness (60) and crank down the cache pressure (50). I WANT it to swap. I want it to swap early and often.
Its using 4 gig of memory with a 6gig swap on SSD in a dual core machine. Sometimes running VMs I'm using more swap space than I am real memory. Its fast as hell.
In /etc/sysctl.conf vm.swappiness = 60 vm.vfs_cache_pressure = 50
I make much more use of swap this way than with the default settings.
Oh, I know I use swap. On the laptop: top - 23:45:17 up 9 days, 10:29, 3 users, load average: 0.19, 0.33, 0.79 Tasks: 285 total, 2 running, 282 sleeping, 0 stopped, 1 zombie %Cpu(s): 6.1 us, 2.1 sy, 0.1 ni, 91.0 id, 0.4 wa, 0.0 hi, 0.1 si, 0.0 st KiB Mem: 3947076 total, 3362332 used, 584744 free, 118484 buffers KiB Swap: 6289412 total, 1458472 used, 4830940 free. 1810508 cached Mem ******** Desktop (rebooted today, so not many tasks) top - 23:46:05 up 8:18, 3 users, load average: 0.59, 0.48, 0.54 Tasks: 462 total, 2 running, 459 sleeping, 0 stopped, 1 zombie %Cpu(s): 11.2 us, 1.8 sy, 0.0 ni, 87.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem: 8174404 total, 7330220 used, 844184 free, 488952 buffers KiB Swap: 43744244 total, 1211500 used, 42532744 free. 3275364 cached Mem ******* I have seen swap at 4 Gigs. When you hibernate, everything goes to swap. The problem is, Leap recovers very slowly. Takes minutes. changing workplace in XFCE to use LOffice, and I have to wait minutes for it to respond.
Now about your worry regarding write to SSD.... Yes write is slower than read. But only because Read is so blindingly fast. Writing on ssd is light years ahead of HDD write speeds. You can only call it slow when viewed in comparison to the same SSD's read speed.
So don't be afraid to write on your SSD, and don't be afraid to use the hell out of your SSD. You will send the machine to recycle long before your ssd wears out.
Another possible source of slowness: discard option in fstab. You want to remove that from every partition in fstab that sits on ssd. Instead use systemd's fstrim.timer.
Ah.
sudo systemctl enable fstrim.timer sudo systemctl start fstrim.timer sudo systemctl status fstrim.service
This will trim you drives once a week (which is plenty) rather than inserting trim operations after ever file delete operation. Discard in the fstab entry can make the machine "feel" slow and causes excess SSD access.
Interesting.
One recommendation for swap on ssd (or any partition on ssd) is to over provision, provide more space than you actually need so as not to force trim operations for space recovery. Ned 8 gig? then partition for 10.
On the one computer with an SSD, I left space not partitioned.
Some links I've found on this subject:
http://www.linux-magazine.com/Issues/2016/187/SSD-tuning
Somewhat dated: Mostly from Ted Ts'o who knows a thing or two about file systems: https://thunk.org/tytso/blog/2009/02/22/should-filesystems-be-optimized-for-... Newer post by Ted Ts'o on this: https://forums.freebsd.org/threads/56951/#post-328912
Also Less specific: https://arstechnica.com/gadgets/2015/04/ask-ars-my-ssd-does-garbage-collecti...
ArchWiki also recommends against discard: https://wiki.archlinux.org/index.php/Solid_State_Drives
Also, (side issue nothing to do with swap) btrfs is not really optimized for ssd. https://btrfs.wiki.kernel.org/index.php/FAQ#Is_Btrfs_optimized_for_SSD.3F
Thanks for the links. No, I stay away from btrfs. I use ext4, xfs, and some reiserfs. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))