public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Javier Guerra <javier@guerrag.com>
Cc: KVM list <kvm@vger.kernel.org>, drbd-user@lists.linbit.com
Subject: Re: kvm, drbd, elevator, rotational - quite an interesting co-operation
Date: Mon, 06 Jul 2009 17:28:55 +0400	[thread overview]
Message-ID: <4A51FC17.8020004@msgid.tls.msk.ru> (raw)
In-Reply-To: <90eb1dc70907021314p140faa87he9c583cca1b391ea@mail.gmail.com>

Javier Guerra wrote:
> On Thu, Jul 2, 2009 at 2:55 PM, Michael Tokarev<mjt@tls.msk.ru> wrote:
>> kvm: i/o threads - should there be a way to control the amount of
>>  threads?  With default workload generated by drbd on secondary
>>  node having less thread makes more sense.
> 
> +1 on this.   it seems reasonable to have one thread per device, or am
> i wrong?

Definitely not one thread per device.  This is because even simple
hard drives nowadays have quite advanced NCQ/TCQ implementations,
when it is better to keep the drive queue deeper than 1, to let
the drive to re-order requests as it see fit, to optimize head
movements etc.

For larger devices (which are arrays of disks with maybe large
battery-backed write caches) more threads makes even more sense.

Also, with this queue/reordering in mind, think about how it should
look like from host vs guest perspective: ideally kvm should be
able to provide a queue of depth >1 to the guest, and that a
guest is "multi-threaded" (multi-processes really) by its own.

To be fair, I can't construct an example when deeper queue may
be bad (not counting bad NCQ implementations).

> it also bothers me because when i have a couple of moderately
> disk-heavy VMs, the load average numbers skyrockets.  that's because
> each blocked thread counts as 1 on this figure, even if they're all
> waiting on the same device.

And how having large LA is bad?  I mean, LA by itself is not an
indicator of bad or good performance, don't you think?

>> kvm: it has been said that using noop elevator on guest makes sense
>>  since host does its own elevator/reordering.  But this example
>>  shows "nicely" that this isn't always the case.  I wonder how
>>  "general" this example is.  Will try to measure further.
> 
> on my own (quick) tests, changing the elevator on the guest has very
> little effect on performance; but does affect the host CPU
> utilization. using drbd on the guest while testing with bonnie++
> increased host CPU by around 20% for each VM

Increased compared what with what?  Also, which virtual disk format
did you use?

By doing just an strace of kvm process here it's trivial to see the
difference: switching from non-rotational to rotational makes kvm
to start writing in large chunks instead of 1024-sized blocks.
Which means, at least, much less context switches, which should
improve performance.  Yes it increases CPU usage somewhat (maybe
around 20%), but it also increases I/O speed here quite significantly.
Your test shows no increase in speed.  Which suggests we're doing
something differently.

/mjt

  reply	other threads:[~2009-07-06 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02 19:55 kvm, drbd, elevator, rotational - quite an interesting co-operation Michael Tokarev
2009-07-02 20:14 ` Javier Guerra
2009-07-06 13:28   ` Michael Tokarev [this message]
2009-07-06 14:07     ` Javier Guerra
2009-07-06 20:00     ` [DRBD-user] " Carson Gaspar
     [not found] ` <4A4D1099.8050709-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
2009-07-03  8:45   ` Lars Ellenberg
2009-07-03 13:06     ` [DRBD-user] " Javier Guerra
     [not found]       ` <200907030806.07624.javier-796Irmz5ZkZBDgjK7y7TUQ@public.gmane.org>
2009-07-03 14:00         ` Lars Ellenberg
2009-07-03 22:59           ` [DRBD-user] " Javier Guerra
     [not found]             ` <90eb1dc70907031559y47c97667s7a38fcb133a42c6d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-06  9:42               ` Lars Ellenberg

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=4A51FC17.8020004@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=drbd-user@lists.linbit.com \
    --cc=javier@guerrag.com \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox