Impact of “discard” mount option on Intel 525 SSD

1368191239_DriveI have replaced my traditional HDD with an Intel 525 SSD (120 GB, mSATA) recently. To keep the write performance high a TRIM option should be enabled. You can either mount the drive with ‘discard’ option, or you can run fstrim command periodically. (This can be a bit trickier if you have LUKS encrypted partitions).

The discard option performs TRIM immediately when a file is deleted, and there is some performance hit involved. You can work around that by having fstrim in a cron job and trimming the disk just once a day or so. It takes longer (about a minute in my case), but it is not a continuous performance hit.

Two years ago Patrick Nagel published a blog about discard performance on his OCZ Vertex LE (100 GB). I was curious whether the numbers would be the same for my SSD. Let’s have a look.

Test description:
With and without discard option let’s do:

  1. Extract linux sources (linux-3.9.1.tar.gz; 45168 files, 592 MB extracted) including sync operation.
    $ time (tar xzf linux-3.9.1.tar.gz ; sync)
  2. Remove the directory including sync operation.
    $ time (rm linux-3.9.1 -rf; sync)

Of course, a few warmup rounds are included. The numbers are averaged from three passes. I have an ext4 partition on LVM on LUKS.

Results:
Without discard
extract: 7,367666667s
delete: 0,709666667s

With discard
extract: 7,373333333s
delete: 2,697333333s

You can also view the raw data.

As you can see, there is a substantial hit on deletion. Removing 45k files was almost 4x slower. But, on the other hand, we’re talking about mere few seconds here, which is way better than in Patrick’s example. I guess the SSD controllers really improved in two years.

I also did a quick second test with deleting a large (3 GB) file. The results are similar – without discard it takes about 0.43s and with discard it takes about 1.65s. So there is no substantial difference between deleting a huge number of smaller files and deleting a single big file.

The output? If you are a general user with no specific needs and you don’t want to bother with cron scripts, you can simply enable the discard option and have your life easier. Of course, we’re talking about Intel 525 here. If you have some other SSD, especially an older one, it might be a good idea to measure the numbers yourself.

Flattr this

Advertisements
Impact of “discard” mount option on Intel 525 SSD

3 thoughts on “Impact of “discard” mount option on Intel 525 SSD

  1. Craig says:

    Hi, grammar nazi here. I think you mean “recently” instead of “lately” in the opening sentence.

    1. Thanks. As a non-native speaker I didn’t see any difference and the dictionary translates it the same. But after googling it a bit, I learned that there truly is a slight difference. Unfortunately I’m not sure I’ll remember that, but I’ll try 🙂

  2. Interestingly, just today – nearly three years after your post – I just got a pingback on my blog post (now nearly five years old) 😉

    My SSD is still working by the way, running 24/7, with periodical fstrim runs.

    Cheers,
    Patrick.

Leave a Reply (Markdown syntax supported)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s