Should I keep my swap file on an SSD drive?

From MSDN Blogs > Engineering Windows 7 > Support and Q&A for Solid-State Drives:

Should the pagefile be placed on SSDs?

Yes. Most pagefile operations are small random reads or larger sequential writes, both of which are types of operations that SSDs handle well.

In looking at telemetry data from thousands of traces and focusing on pagefile reads and writes, we find that

  • Pagefile.sys reads outnumber pagefile.sys writes by about 40 to 1,
  • Pagefile.sys read sizes are typically quite small, with 67% less than or equal to 4 KB, and 88% less than 16 KB.
  • Pagefile.sys writes are relatively large, with 62% greater than or equal to 128 KB and 45% being exactly 1 MB in size.

In fact, given typical pagefile reference patterns and the favorable performance characteristics SSDs have on those patterns, there are few files better than the pagefile to place on an SSD.


Here is some S.M.A.R.T. data from an OCZ-AGILITY SSD that I have used in a Linux laptop for around two years.

I have a swap partition on the disk, and the only "tweak" I've made is to set swappiness = 0 in Linux. The windows swap profile is more or less like Linux swappiness = 0.

It's my personal laptop, so it's not used 8 hours a day (more like 1.5 hours), but I do quite a lot of development on it, so there is a lot of file creation going on.

  9 Power_On_Hours          1199
 12 Power_Cycle_Count       2753
184 Initial_Bad_Block_Coun  0
195 Program_Failure_Blk_Ct  0
196 Erase_Failure_Blk_Ct    0
197 Read_Failure_Blk_Ct     0
198 Read_Sectors_Tot_Ct     1311815826
199 Write_Sectors_Tot_Ct    1546123387
200 Read_Commands_Tot_Ct    22347850
201 Write_Commands_Tot_Ct   31599623
202 Error_Bits_Flash_Tot_Ct 55136
203 Corr_Read_Errors_Tot_Ct 54890 
204 Bad_Block_Full_Flag     0
205 Max_PE_Count_Spec       10000
206 Min_Erase_Count         266
207 Max_Erase_Count         2166
208 Average_Erase_Count     842
209 Remaining_Lifetime_Perc 92

The interesting parts are:

  • Power_On_Hours (I spend too much time in front of a computer.)
  • Max_PE_Count_Spec is 10000, which is the minimum number of reflashes a block can cope with.
  • Min, Max and Average Erase count tells a little bit about the robustness of the wear-leveling algorithm. I suppose it's quite OK that the worst block has been flashed about two times more often than average.
  • The remaining lifetime percentage, which is 92%.

So... I think it's safe to assume that the disk should last until I retire it for other reasons. (*touch wood) It's already too small...

Assuming the numbers scale, 40 hour/week would give a life time of at least 3-4 years - probably more, since I suspect I am more efficient at wearing out my disk at home... Fewer meetings... So, I think it's quite OK for a work machine, given the benefits.

100% / (40h/(1199/(2*52w)) * 8% = 3.6  // Did I get that right, eh...

So, my advice is: Get rid of the noisy mechanical drives and enjoy the silence :-)

It's awesome with an absolutely quiet laptop.


I retired the drive some time ago, after more than 5 years in service. I needed a bigger drive, and it was also nice to get a faster one. Some blocks have definitely died, but it looks like it could hold together a few more years.

By the way, it certainly survived the laptop it was originally installed in.

9 Power_On_Hours                  3965
12 Power_Cycle_Count              8755
184 Initial_Bad_Block_Count          0
195 Program_Failure_Blk_Ct           0
196 Erase_Failure_Blk_Ct             0
197 Read_Failure_Blk_Ct              0
198 Read_Sectors_Tot_Ct     5438181603
199 Write_Sectors_Tot_Ct    4223860468
200 Read_Commands_Tot_Ct     108147770
201 Write_Commands_Tot_Ct     87443515
202 Error_Bits_Flash_Tot_Ct     364621
203 Corr_Read_Errors_Tot_Ct     350922
204 Bad_Block_Full_Flag              0
205 Max_PE_Count_Spec            10000
206 Min_Erase_Count                940
207 Max_Erase_Count               7808
208 Average_Erase_Count           3119
209 Remaining_Lifetime_Perc         69
211 SATA_Error_Ct_CRC                0
212 SATA_Error_Ct_Handshake          0
213 Indilinx_Internal                0

I have a better answer: Why, when you can just buy more RAM? RAM is as cheap or cheaper than SSD space. It's also much faster, and it will never (well, almost never) degrade like SSD drives do.

Swapping memory to disk is a symptom of not enough RAM. If you need to speed up swapping, don't speed up the swap disk, upgrade your RAM and the swapping will go away. Swapping should be considered a last-resort backup plan anyway.

Tags:

Windows

Swap

Ssd