On 2016-04-27 10:31, Bjoern Voigt wrote:
Carlos E. R. wrote:
...
Yes, I though this too and it sound logical. But even with 16 GB RAM I had the problem, that "swapoff -a" tooks much time. I will get my 16 GB RAM back soon, so I can post additional test cases.
Here is a new test case with 8 GB RAM:
mybox:~ # free -m total used free shared buff/cache available Mem: 7914 4391 253 27 3269 3335 Swap: 37383 1377 36006 mybox:~ # time swapoff -a
real 3m40.079s user 0m0.008s sys 3m0.792s mybox:~ # free -m total used free shared buff/cache available Mem: 7914 5548 57 53 2308 2152 Swap: 0 0 0
Well, you see, before swapoff you have 253MB free ram, and 1377MB in swap. It just doesn't fit! It had to eat ram from buffers and cache (which makes the computer slower). This operation takes time to do, as (I understand) affected programs have to be notified.
All values are in Megabytes.
I prefer "free -h", it is easier to read. Figures have the units next to them.
Swapoff takes 3:40 minutes to free 1377 MB used SWAP space. RAM is enough because 3269 MB buffer/cache space is available.
But not directly free.
1377 MB in 3:40 minutes mean 6,25 MB per second. My 3 TB WD Red hard disk should have up to 147 MB per second. Of course this a theoretical value, but a SWAP partition can't be fragmented and there was not much other I/O activit
I don't think disk speed is the factor here. It is possible that the system has to juggle sections in and out of swap repeatedly. Like those sliding puzzles: https://en.wikipedia.org/wiki/Sliding_puzzle#/media/File:15-puzzle.svg It is also possible that it involves some big/slow application that has to be told. :-?
Any ideas? What is a reasonable time for swapoff?
I don't dare to try in my machine (I have swap 1.4G in use), but I do remember that it is quite slow. I don't remember how much.
Actually, disabling swap will make matters worse. I don't plan this. But I sometimes have discussions with Linux beginners which say: "I had a lot of memory (4 GB). I do not need swap. Swap destroys my SSD or my hard disk." It's difficult to explain them, that SWAP is good anyway. But this is another topic.
Then why do you want to disable it? :-? I only do that operation for maintenance operations with disks. Possibly kernel devs have not optimized an operation that is seldom done. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)