Re: Testing devices for discard support properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 5/7/19 5:24 PM, Chris Mason wrote:
On 7 May 2019, at 16:09, Bryan Gurney wrote:

I found an example in my trace of the "two bands of latency" behavior.
Consider these three segments of trace data during the writes:


[ ... ]

There's an average latency of 14 milliseconds for these 128 kilobyte
writes.  At 0.218288794 seconds, we can see a sudden appearance of 1.7
millisecond latency times, much lower than the average.

Then we see an alternation of 1.7 millisecond completions and 14
millisecond completions, with these two "latency groups" increasing,
up to about 14 milliseconds and 25 milliseconds at 0.241287187 seconds
into the trace.

At 0.317351888 seconds, we see the pattern start again, with a sudden
appearance of 1.89 millisecond latency write completions, among 14.7
millisecond latency write completions.

If you graph it, it looks like a "triangle wave" pulse, with a
duration of about 23 milliseconds, that repeats after about 100
milliseconds.  In a way, it's like a "heartbeat".  This wouldn't be as
easy to detect with a simple "average" or "percentile" reading.

This was during a simple sequential write at a queue depth of 32, but
what happens with a write after a discard in the same region of
sectors?  This behavior could change, depending on different drive
models, and/or drive controller algorithms.


I think these are all really interesting, and definitely support the
idea of a series of tests we do to make sure a drive implements discard
in the general ways that we expect.

But with that said, I think a more important discussion as filesystem
developers is how we protect the rest of the filesystem from high
latencies caused by discards.  For reads and writes, we've been doing
this for a long time.  IO schedulers have all kinds of checks and
balances for REQ_META or REQ_SYNC, and we throttle dirty pages and
readahead and dance around request batching etc etc.

But for discards, we just open the floodgates and hope it works out.  At
some point we're going to have to figure out how to queue and throttle
discards as well as we do reads/writes.  That's kind of tricky because
the FS needs to coordinate when we're allowed to discard something and
needs to know when the discard is done, and we all have different
schemes for keeping track.

-chris


Trying to summarize my thoughts here after weeks of other stuff.

We really have two (intertwined) questions:

* does issuing a discard on a device do anything useful - restore flagging performance, enhance the life space of the device, etc?

* what is the performance impact of doing a discard & does it vary based on the size of the region? (Can we use it to discard a whole device, do it for small discards, etc)

To answer the first question, we need a test that can verify that without discards (mount with nodiscard), we see a decline in performance. For example, multiple overwrites of the entire surface of the device (2 -3 full device writes) to make sure all of the spare capacity has been consumed, run the target workload we want to measure, then do discards of the whole space and run that same target workload.

If the discard does something useful, we should see better performance in that second test run.

If discard does not do anything useful, we are "done" with that device - no real need to measure performance of a useless mechanism. (Punting on the device longevity stuff here, seems like that should be left to the hardware vendors).

To answer the second question, we need to measure the performance of the discard implementation.

We still have to work to get any device into a well known state - do multiple, full device writes without discards. 2-3 passes should do it.

Then run our specific discard test workload - measure the performance of large discards (cap the size by the max permitted by the device) and small, single page discards. Important to capture min/max/average times of the discard. I think it would be best to do this on the block device to avoid any file system layer performance impact of deleting files/tweaking extents/etc.

Probably easiest to do separate tests for interesting discard sizes (each time, doing the full device writes to get back to a known state ahead of the test).

This is not meant to be a comprehensive tests/validation, but I think that doing the above would be a way to get a good sense of the effectiveness and performance of the device mechanism.

Make sense? Did I leave something out?

Ric



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux