Does having swap memory damage SSDs too much, what do you think about it?

  • Kangie@lemmy.srcfiles.zip
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    Does having swap memory damage SSDs

    Not to the point that it’s worth worrying about. Seriously. Unless you’re on something stupid like an SD card the write endurance of a SSD will be fine for the purposes of swap.

    If you’re regularly thrashing the swap it’s still fine, but maybe rethink what you’re doing anyway because there’s probably a better way

  • BlahajEnjoyer@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    People think that Windows doesn’t do swap because on Windows it’s done automatically for you. Does it wear down the SSD? Yes, but so does every other write operation. Ideally, getting like 32gigs of ram so you’ll never have to use your swap is ideal(or at least use less), but not everyone can do that.

  • jet@hackertalks.com
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    1 year ago

    SSDs have a limited number of lifetime writes. Depending on the size of the swap file and the frequency in which you write to it you could go through your lifetime writes faster than you expect. You can keep an eye on it by looking at your drives health metrics. It will tell you how many writes it’s used. Usually in a percentage term

    If you pull up the data sheet for your drive it’ll tell you the total number of writes it’s rated for.

  • nothacking@discuss.tchncs.de
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I have done some tests, and under low memory conditions, when frequently writing to the drive (especially with a high /proc/sys/vm/dirty_writeback_centisecs) swap can actually reduce the amount of writes to the drive. If you do have enough memory, swap is hardly used but still results in a noticeable speed improvement.

  • emptyother@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I did calculate it once on an older samsung drive. If you write multiple terabytes every day, you will cross samsungs estimated lifetime in 3 years.

    I have no idea how much data a swap partition move per day but it can’t be near that much?

    • kev@lemmy.kevhomeit.trade
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      But the swap partition is only used when you run out of ram right? If I have enough ram I should not worry about that.

        • jet@hackertalks.com
          link
          fedilink
          English
          arrow-up
          3
          ·
          1 year ago

          100% this. An aggressive memory manager could preemptively write everything from memory to swap even though it’s still in memory, in case it has to evict it quickly.