All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@redhat.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] lvmcache in writeback mode
Date: Mon, 5 Jan 2015 09:35:05 +0000	[thread overview]
Message-ID: <20150105093504.GB11818@debian> (raw)
In-Reply-To: <54A3DC94.3000209@nethuis.nl>

On Wed, Dec 31, 2014 at 12:23:00PM +0100, Pim van den Berg wrote:
> But... when I look at the CPU usage of the VM there is 8-10% Wait-IO
> (this also matches the 2 graphs mentioned above almost 1-on-1):
> http://pommi.nethuis.nl/wp-content/uploads/2014/12/lvmcache-vm-load.png
> 
> This is equal to having no SSD cache at all or bcache in
> writethrough mode. I was expecting ~1% Wait-IO.
> 
> How can this be explained?
> 
> From the stats its clear that the pattern of "Network Packets",
> being NFS traffic, matches the lvmcache "Write hits" pattern. Does
> lvmcache in writeback mode still wait for its data to be written to
> the HDD? Does "Write hits" mean something different? Is "dmsetup
> status" giving me wrong information? Or do I still have to set some
> lvmcache settings to make this work as expected?

I think your expectations of writeback mode are correct, but to spell
it out here some pseudo code.

In writeback mode:

   if block is on ssd
      write to ssd, complete bio once written
      increment write hit counter
   else
      write to origin and complete
      increment write miss counter

writethrough mode:

   if block on ssd
      write to ssd, then origin, complete
      increment write hit counter
   else
      write to origin and complete
      increment write miss counter


Some things that can slow down IOs:

- Changing a mapping due to the promotion or demotion of a block
  requires and metadata commit. (Check LVM2 has put the metadata on
  the ssd rather than spindle).

- REQ_DISCARD.  This is an expensive operation.  I advise people to
  periodically use fstrim rather than having the fs do it
  automatically when it deletes files.

- Background writeback IO could possibly be interferring with incoming
  writes.  eg, if a dirty block is being written back when a write to
  that block comes in then the write will be stalled.  Looking at the
  code I can see we're being very agressive about writing everything
  back irrespective of how recently the block was hit.  It would be
  trivial to change it to only writeback after a number of policy
  'ticks'.  I'll do some experiments ...

- Joe

  reply	other threads:[~2015-01-05  9:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-31 11:23 [linux-lvm] lvmcache in writeback mode Pim van den Berg
2015-01-05  9:35 ` Joe Thornber [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-01-01 11:20 Pim van den Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150105093504.GB11818@debian \
    --to=thornber@redhat.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.