Follow By Email

Thursday, December 1, 2022

[New post] Tracking swap space: is it wearing out your SSD?

Site logo image hoakley posted: "When your current Mac dies and goes for recycling, the most likely cause will be failure of its logic board, as it's generally the most expensive component. The logic board of most modern Macs includes its chip or chipset, memory and internal SSD. While p" The Eclectic Light Company

Tracking swap space: is it wearing out your SSD?

hoakley

Dec 2

When your current Mac dies and goes for recycling, the most likely cause will be failure of its logic board, as it's generally the most expensive component. The logic board of most modern Macs includes its chip or chipset, memory and internal SSD. While predicting the working life of most components isn't possible, the one we can estimate is that for the SSD. This is because SSDs can only write to their memory a set number of times before they stop working: if you know how many times that is, then you can measure how much of its lifetime is remaining in an SSD, a feature provided by apps like DriveDx.

It turns out from reports of many users that even the most industrious of us don't write enough data to the internal SSD of our Macs to wear them out over their normal expected lifetime of around ten years. At my current level of SSD use, this iMac Pro should be good for another 50 years or more.

However, one factor can greatly increase the quantity of data written to a boot SSD: excessive use of 'swap' space by virtual memory. In extreme cases, this could run an SSD into the ground in less than five years, thus sending that Mac to an early grave. This article looks at how you could detect this on your Mac's internal SSD.

Swap used

Total write figures from DriveDx and similar utilities are good for giving the overall picture, but don't tell you what was responsible for the total amount of data written. To separate what's the result of swap usage you need to look deeper at memory use. This is shown in Activity Monitor and the size of the VM volume in your boot volume group, shown by selecting its container in Disk Utility. When there's no swap use, that VM volume should be tiny, less than 1 MB. In the Memory tab of Activity Monitor, the figure for Swap Used should be zero.

vm_stat

Those only tell you the current amount of swap in use. To get a fuller picture over time, you'll need to resort to Terminal's command line, and the command vm_stat, which reports swapins and swapouts. These get a bit more complicated.

vm_stat can be used in either of two ways. When used without options, it gives a set of statistics for virtual memory use since that Mac last started up; when used with options to obtain multiple samples, the first gives total use since reboot, then subsequent figures are changes since the last set. For these purposes, simply entering the command
vm_stat
shortly before you shut your Mac down or restart it will give figures at the end for swapins and swapouts, in my case
Swapins: 0.
Swapouts: 0.

Used with the options
vm_stat -c 1 1
you'll also get a single list, this time squeezed into two rows, containing at the end
swapins swapouts
0 0

By convention, swapins are pages of memory retrieved from VM storage to physical memory, and swapouts go the other way, from physical memory to VM storage. Read man vm_stat and you'll become confused, as that defines them as:

  • Swapins: the total number of compressed pages that have been swapped out to disk.
  • Swapouts: the total number of compressed pages that have been swapped back in from disk.

which is the other way around. Looking at Apple's open source code, it appears that this is a documentation error, and what you should be interested in are swapouts rather than swapins. Perhaps it's simplest just to take the larger value.

Figures given aren't in bytes, but pages. At the head of each set of results, vm_stat should report pagesize, the size of pages in bytes, which does differ between Intel Macs (4096 bytes) and Apple silicon models (16384 bytes), and can be obtained separately using the pagesize command if you want to check. To work out the total swapped out (or in), simply multiply the number of pages given, by the pagesize.

Keep a record of daily swap totals, and you can then set those against reported total data written to that SSD. If the amount written by swap is less than 10% of the total data written, then swap use is contributing little to SSD wear. If it's 50% or higher, then having more physical memory would significantly reduce SSD wear. If the amount used for swap is prematurely ageing your Mac's SSD, try increasing the amount of physical memory in your next Mac, as that should prolong its working life.

Comment
Like
Tip icon image You can also reply to this email to leave a comment.

Unsubscribe to no longer receive posts from The Eclectic Light Company.
Change your email settings at manage subscriptions.

Trouble clicking? Copy and paste this URL into your browser:
http://eclecticlight.co/2022/12/02/tracking-swap-space-is-it-wearing-out-your-ssd/

Powered by WordPress.com
Download on the App Store Get it on Google Play
at December 01, 2022
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

[New post] Godzilla Library Edition by James Stokoe, John Layman, Chris Mowry, Alberto Ponticelli, Dean Haspiel

...

  • [New post] Godzilla Library Edition by James Stokoe, John Layman, Chris Mowry, Alberto Ponticelli, Dean Haspiel
    ...
  • Chocolate Chip M&M Cookies + AUGUST BAKING CHALLENGE
    The universe wants you to make cookies, just sayin'  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ...
  • Your Guide to Winter Squash
    ...

Search This Blog

  • Home

About Me

PH News Net
View my complete profile

Report Abuse

Labels

  • 【ANDROID STUDIO】Data Binding
  • 【ANDROID STUDIO】Data Binding Show or Hide Progressbar
  • 【ANDROID STUDIO】Data Binding with object
  • 【ANDROID STUDIO】Live Data
  • 【ANDROID STUDIO】Live Data with Data Binding
  • 【ANDROID STUDIO】View Model
  • 【ANDROID STUDIO】ViewModel Data Binding
  • 【ANDROID STUDIO】ViewModel Data Binding Factory
  • 【FLUTTER ANDROID STUDIO and IOS】Common Weight and Mass Conversions
  • 【FLUTTER ANDROID STUDIO and IOS】custom lite rolling switch
  • 【FLUTTER ANDROID STUDIO and IOS】Managing State
  • 【FLUTTER ANDROID STUDIO and IOS】Simple Stopwatch
  • 【FLUTTER ANDROID STUDIO and IOS】Specify Height and Width in Percent with respect to the screen
  • 【FLUTTER ANDROID STUDIO and IOS】tab key or shift focus to next text field
  • 【FLUTTER ANDROID STUDIO and IOS】Weight Convert
  • 【GAMEMAKER】Display
  • 【GAMEMAKER】Draw Name
  • 【GAMEMAKER】enemy fire continously
  • 【GAMEMAKER】Energy
  • 【GAMEMAKER】Explosion
  • 【GAMEMAKER】Health Bar
  • 【GAMEMAKER】Hearts
  • 【GAMEMAKER】Highscore
  • 【GAMEMAKER】Horizontal Shooter
  • 【GAMEMAKER】Inventory
  • 【GAMEMAKER】keep the player facing the mouse pointer
  • 【GAMEMAKER】one way to do a fog of war
  • 【JAVASCRIPT】implements draggable progress bar
  • 【JAVASCRIPT】Math Quiz GAME export CSV
  • 【LARAVEL】PHPWord pass dynamic values when export to ms docx and download using PHPWord
  • 【PYTHON OPENCV】Image classification in Keras using several models for image classification with weights trained on ImageNet
  • 【PYTHON PYTORCH】metric classification accuracy
  • 【PYTHON PYTORCH】metric classification report
  • 【PYTHON】algorithm compare all classification models
  • 【PYTHON】algorithm evaluation k fold cross validation
  • 【PYTHON】leave one out cross validation
  • 【PYTHON】metric confusion
  • 【PYTHON】metric regression mae
  • 【VISUAL Csharp】Enumerate network resources
  • 【VISUAL Csharp】File Properties
  • 【Visual Studio VB NET】Clear Saved Passwords
  • 【Visual Studio VB NET】Swap mouse button
  • 【Visual Studio VB NET】System Properties Remote
  • 【Visual Studio Visual Csharp】Get computer name
  • 【Visual Studio Visual Csharp】Get Disk Free Space
  • 【Visual Studio Visual Csharp】Get processor type
  • 【Visual Studio Visual Csharp】IP Address
  • 【VISUAL VB NET】Delete Form Data
  • 【VISUAL VB NET】Delete History
  • 【VISUAL VB NET】Hibernate
  • 【VISUAL VB NET】Keyboard Properties
  • 【VISUAL VB NET】Sound
  • 【VISUAL VB NET】Tray Icon
  • 【VISUAL VB NET】Web Browser
  • 【Vuejs】 table implements adding and deleting
  • 【VUEJS】seamless carousel effect Marquee using transition

Blog Archive

  • October 2023 (25)
  • September 2023 (1209)
  • August 2023 (1224)
  • July 2023 (1259)
  • June 2023 (1245)
  • May 2023 (1194)
  • April 2023 (1137)
  • March 2023 (1163)
  • February 2023 (1107)
  • January 2023 (1313)
  • December 2022 (1358)
  • November 2022 (1353)
  • October 2022 (1300)
  • September 2022 (1208)
  • August 2022 (1279)
  • July 2022 (1228)
  • June 2022 (1164)
  • May 2022 (1176)
  • April 2022 (1184)
  • March 2022 (1337)
  • February 2022 (1232)
  • January 2022 (1321)
  • December 2021 (1932)
  • November 2021 (3065)
  • October 2021 (3186)
  • September 2021 (3078)
  • August 2021 (3175)
  • July 2021 (3198)
  • June 2021 (3136)
  • May 2021 (1856)
Powered by Blogger.