Monday, January 16, 2012

Long Live ... SSD!

I pretty assume you'are using Linux :-)

Some advices to make your SSD live longer

  • Enable TRIM command from filesystem to disk firmware (ext4 has option 'discard', see man 8 mount)
  • set 'noatime' and 'nodiratime' options (again, see man 8 mount)
  • enlarge /proc/sys/vm/dirty_writeback_centisecs up to 60000 (60 seconds) to make pdflush write rarely
Do you know any more?

Surely, do not apply it blindly: there are many explanation why OS have to work w/ solid drives differently comparing with usual HDD:
  1. Illustrated process of rewriting block
  2. wear-leveling, or how solid state drives (or even USB sticks) remap data blocks.
  3. How to configure TRIM in Ubuntu and other distros. With little benchmarking


Also it's worth to change default IO scheduler to "noop". This will boost synchronous operations in case of distributed read requests. Many peoples thing it reduces much CPU cycles of "too smart" defult schedulers: CFQ or deadline. But I think the plenty of effect is not in CPU time. Instead, it reduces average of IO request waiting it's time to be actually send to device. Because "noop" scheduler does not buffer IO requests.

I saw big difference with iostat(1)' "await" column; from manpage it is "The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them". For my workload it decreased 8 times!

To switch your disk' scheduler to noop perform:

$ echo noop | sudo tee /sys/block/sda/queue/scheduler # my SSD is sda

And, certainly we have to do this thing each time on system boot. The most native way to do this in Ubuntu, as I found, is via procps:

$ sudo apt-get install procps

Then add following line to /etc/sysfs.conf:

block/sda/queue/scheduler = noop

No comments:

Post a Comment