1. Things you need to know about the new ‘Conversations’ PM system:

    a) DO NOT REPLY TO THE NOTIFICATION EMAIL! I get them, not the intended recipient. I get a lot of them and I do not want them! It is just a notification, log into the site and reply from there.

    b) To delete old conversations use the ‘Leave conversation’ option. This is just delete by another name.
    Dismiss Notice

Linux (Mint flavour) swappiness?

Discussion in 'off topic' started by Darth Vader, Sep 4, 2019.

  1. Darth Vader

    Darth Vader From the Dark Side

    My understanding (and it may be wrong) is that the swap file is not used until only the % of RAM set in the swap config is left. Since I have 32GB RAM I have set the value to 10 (default is 60) so no swapping should occur until I only have 10% left i.e. 3.2GB.

    However the system monitor says that I am using 10% of RAM but the system has used 16MB (0.1%) of the swap partition. I wonder why?

    The reason that I am concerned is that the swap partition is on an SSD and unnecessary swapping will eat into the TBW. Sure at the mo its only a small amount but as I am working and filling up RAM there might be a lot more swapping.

    Maybe I misunderstand or need to config summat else as well.

    This might also apply to Windows page file swapping on cheap SSDs thus shortening their lives.

    Cheers,

    DV
     
  2. gintonic

    gintonic 50 shades of grey pussy cats

    it does, and shortens the life of expensive ones as well. I have had 3 SSDs go tits up on my in the last three years. Good brands. I haven't lost a mech hdd for about 10 years.
     
  3. PaulMB

    PaulMB pfm Member

    This is terrible news! I just put an SSD into an 11-year-old laptop with a failing HD, and was about to buy a brand new laptop with an SSD, assuming that SSD is absolutely "A Good Thing". So mechanical is better!?

    And regarding the Swap Partition in Linux OSs I had no idea this could put stress on the HD. Is it perhaps better not to create a Swap Partition at all?
     
  4. gintonic

    gintonic 50 shades of grey pussy cats

    who knows. My work desktop only has SSDs and time will tell. Maybe I got unlucky with the 3 SSDs and lucky with the longevity of my mech hdds
     
  5. gavreid

    gavreid pfm Member

    Not really - treat them in the same way but you don't want to be using the new quad bit type, e.g. samsung QVO, with the reduced warranty.
     
  6. Darth Vader

    Darth Vader From the Dark Side

    An SSD and HD work differently and have advantages/disadvantages. With the rewriteable 'flash' type of memory there are a limited number of write cycles that limits their effective life. This is usually given as the TBW = total bytes written. If the SSD is mainly read e.g. like in a music server then the SSD should have a long life limited by things like heat and over voltage.

    However if the SSD is subjected to a lot of writes then its life is shortened depending on several factors. In the past computer hardware was prohibitively expensive especially RAM so in entry level machines the hard disk was used as virtual memory i.e. DOS vs OS computers and no this was before the micro computer was invented, As the RAM is used up memory is swapped out to disk and then swapped back later. This techniqe was carried over to what has now become cheap commercial everyday computers that again because the hardware was initially very expensive used cheap HD as virtual memory.

    Today if you have a computer running Win 10 with just 4GB of memory you'll have just 2GB spare after the o/s has loaded hence depending on what you are doing there may be a lot of swapping from RAM to storage. If thats a cheap SSD with limited TBW then a lot of swapping may result in early SSD death. Its just one of those things to bear in mind when choosing a PC for any given task.

    In my case I am a heavy user and if swapping is carried out unnecessary (I have 32GB RAM) then it might unnecessarily shorten the life of my SSD.

    Cheers,

    DV
     
  7. thebiglebowski

    thebiglebowski pfm Member

    Turn it off then, with 32GB RAM you shouldn't need to swap.
     
    gintonic likes this.
  8. gintonic

    gintonic 50 shades of grey pussy cats

    deep learning, dont forget the deep learning, and all those 100s of pointless VMs running ancient and pointless O/S's, all the Linux memory leaking ejaculating 1's and 0's all over the carpet
     
  9. PaulMB

    PaulMB pfm Member

    So, in practice, if one wants a cheap laptop, or desktop for that matter, with, say, only 4 or 8 Gb RAM, one should get one with a mechanical HD? A pity, I had understood that SSDs were the solution to all HD failures....In my case it would be running Linux Kubuntu.
    Apologies, Darth, for semi-hijacking the thread. But maybe of general interest.
     
  10. thebiglebowski

    thebiglebowski pfm Member

    No, it's really not a massive issue. DV is wrong in that TBW actually means terabytes written and on a system with 8GB of RAM even if swapping occurs it is unlikely to wear out the flash before the laptop is replaced or the SSD replaced/upgraded.
     
  11. suzywong

    suzywong Shifting 0s & 1s since 1968

    And there was I thinking that TBW stood for “That Bl00dy Woman”, referring to a British Prime Minister of a couple of decades ago! (IIRC it was courtesy of Ken Clarke MP).

    As for swapping to hard disk, I think it was the Ferranti Atlas that introduced “paging”.
     
  12. Darth Vader

    Darth Vader From the Dark Side

    Nope. My Samsung warranty says for my SSD TBW = 600 terabytes so total bytes written = 600 TB. If it was as you say then TBW should just be the number 600.

    From the Samsung website:-
    "Warranty Policy

    SAMSUNG warrants to the purchaser of the Product in its original sealed packaging ("You”) that the Product is free from defects in material and workmanship, subject to the conditions stated herein, for THE SHORTER OF : (I) THE LIMITED WARRANTY PERIOD, WHICH DURATION IS SPECIFIED IN SECTION B OF THIS AGREEMENT, BEGINNING ON THE DATE THE PRODUCT WAS PURCHASED IN ITS ORIGINAL SEALED PACKAGING; OR (II) THE PERIOD ENDING ON THE DATE WHEN THE SSD HAS EXCEEDED ITS TBW (TOTAL BYTES WRITTEN) THRESHOLD AS MAY BE INDICATED BY SAMSUNG’S MAGICIAN SOFTWARE (FOR SPECIFIC INFORMATION ON THIS THRESHOLD, PLEASE REFER TO THE DATA SHEET FOR YOUR PARTICULAR SSD PRODUCT, WHICH IS AVAILABLE AT www.samsung.com/ssd, www.samsung.com/samsungssd)"

    As ever usage depends but why unnecessarily wear an SSD by not needed swapping? The Linux default of 60 means that even with 32GB of RAM the swapping should start after 12.8GB of RAM is used. Thats peanuts for me and I shouldn't need to swap until I'm around 90% memory in use so the default is unnecessarily eating up my TBW.

    Soooo why is the system using swap when I'm only using 10% of RAM?

    TTFN,

    DV
     
    Last edited: Sep 5, 2019
  13. davidsrsb

    davidsrsb pfm Member

  14. chartz

    chartz pfm Member

    About SSD life span, I’ve got two Macs, one is 8 years old (a lot of video and Photoshop) and the other one is 6 years old and on almost 24/7.
     
  15. Cesare

    Cesare pfm Member

    Swap gets used only where there is pressure on memory. There is no 'it starts getting used at such a point' concept. If you end up with memory pressure at some point (say the running processes require 40gb of total RAM on your 32gb machine) then 8gb will have been swapped to disk. If the memory pressure is reduced (say a large RAM using process terminates) then as the remaining processes that have swapped pages visit their swapped pages, they'll be pulled into RAM and the amount of swap space will steadily reduce over time.

    If a page got swapped for a process which is not visited again, then it'll stay in swap until it's needed, so even if the total memory use is reduced, and stays low, the swap use will not reduce to 0 until that process terminates.

    I'd personally run without swap on a 32gb machine.

    As for swap and SSD life, I think it's not actually a problem as the levelling stuff sorts this out. HDs have a limited life, generally from operational hours, so there's no perfect way of storing data for ever without some risk of failure, and in general an SSD is more reliable than a HD. I'd not worry about reducing the working life of an SSD by storing stuff on it, but just factor in the expectation that it has a lifetime of a given number of years.

    Have a look here:

    https://techreport.com/review/27909/the-ssd-endurance-experiment-theyre-all-dead/

    The basic idea was to write continuously to a bunch of SSDs and to see what the lifetime was. The key metric is reallocated sectors, so as the wear accumulates this starts going up, so it's the figure to find and track on an SSD to check that you are approaching EOL.

    Given then got into the PB written range with some of the drives, and approaching 1 PB (around 800TB) was the lowest they saw, you are looking at something like a year to write that much data to the drive if you write continuously 24/7. If the machine is used 8 hours a day, then that's a 3 year life if running at maximum speed for those hours, so you can see that worrying about wear is probably not that important.

    Rather than swap, I run compiles on SSD based machines so that produces a massive amount of disk churn as lots of files are deleted and recreated as part of that process. However, the machine is probably running full on 10% of the time (finger in the air estimate) so i've probably got 30 years of doing this as the lifetime of the disk worst case.
     
  16. gavreid

    gavreid pfm Member

    This explains some of the subtleties about SSDs

     
  17. boneman

    boneman pfm Member

  18. Darth Vader

    Darth Vader From the Dark Side

    Many thanks for the feedback from above posters. I now have a much better understanding.

    Cheers,

    DV
     
  19. PaulMB

    PaulMB pfm Member

    So for a modest, ordinary, Linux machine, which gets turned off at night and has no constant operation, portable or desktop, when it comes to choosing HD or SSD what is the consensus from those competent?
     
  20. gavreid

    gavreid pfm Member

    I've attempted to answer that for you twice already. SSD is faster, nvme much faster than sata. A good hard drive is on a par re reliability.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice