All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Xiao Guangrong <guangrong.xiao@gmail.com>
Cc: liang.z.li@intel.com, kvm@vger.kernel.org, quintela@redhat.com,
	mtosatti@redhat.com, Xiao Guangrong <xiaoguangrong@tencent.com>,
	qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
	mst@redhat.com, pbonzini@redhat.com
Subject: Re: [PATCH 1/8] migration: stop compressing page in migration thread
Date: Tue, 27 Mar 2018 20:12:44 +0100	[thread overview]
Message-ID: <20180327191243.GK2837@work-vm> (raw)
In-Reply-To: <73e25db4-997f-0fbf-0c73-6589283c4005@gmail.com>

* Xiao Guangrong (guangrong.xiao@gmail.com) wrote:
> 
> 
> On 03/26/2018 05:02 PM, Peter Xu wrote:
> > On Thu, Mar 22, 2018 at 07:38:07PM +0800, Xiao Guangrong wrote:
> > > 
> > > 
> > > On 03/21/2018 04:19 PM, Peter Xu wrote:
> > > > On Fri, Mar 16, 2018 at 04:05:14PM +0800, Xiao Guangrong wrote:
> > > > > 
> > > > > Hi David,
> > > > > 
> > > > > Thanks for your review.
> > > > > 
> > > > > On 03/15/2018 06:25 PM, Dr. David Alan Gilbert wrote:
> > > > > 
> > > > > > >     migration/ram.c | 32 ++++++++++++++++----------------
> > > > > > 
> > > > > > Hi,
> > > > > >      Do you have some performance numbers to show this helps?  Were those
> > > > > > taken on a normal system or were they taken with one of the compression
> > > > > > accelerators (which I think the compression migration was designed for)?
> > > > > 
> > > > > Yes, i have tested it on my desktop, i7-4790 + 16G, by locally live migrate
> > > > > the VM which has 8 vCPUs + 6G memory and the max-bandwidth is limited to 350.
> > > > > 
> > > > > During the migration, a workload which has 8 threads repeatedly written total
> > > > > 6G memory in the VM. Before this patchset, its bandwidth is ~25 mbps, after
> > > > > applying, the bandwidth is ~50 mbps.
> > > > 
> > > > Hi, Guangrong,
> > > > 
> > > > Not really review comments, but I got some questions. :)
> > > 
> > > Your comments are always valuable to me! :)
> > > 
> > > > 
> > > > IIUC this patch will only change the behavior when last_sent_block
> > > > changed.  I see that the performance is doubled after the change,
> > > > which is really promising.  However I don't fully understand why it
> > > > brings such a big difference considering that IMHO current code is
> > > > sending dirty pages per-RAMBlock.  I mean, IMHO last_sent_block should
> > > > not change frequently?  Or am I wrong?
> > > 
> > > It's depends on the configuration, each memory-region which is ram or
> > > file backend has a RAMBlock.
> > > 
> > > Actually, more benefits comes from the fact that the performance & throughput
> > > of the multithreads has been improved as the threads is fed by the
> > > migration thread and the result is consumed by the migration
> > > thread.
> > 
> > I'm not sure whether I got your points - I think you mean that the
> > compression threads and the migration thread can form a better
> > pipeline if the migration thread does not do any compression at all.
> > 
> > I think I agree with that.
> > 
> > However it does not really explain to me on why a very rare event
> > (sending the first page of a RAMBlock, considering bitmap sync is
> > rare) can greatly affect the performance (it shows a doubled boost).
> > 
> 
> I understand it is trick indeed, but it is not very hard to explain.
> Multi-threads (using 8 CPUs in our test) keep idle for a long time
> for the origin code, however, after our patch, as the normal is
> posted out async-ly that it's extremely fast as you said (the network
> is almost idle for current implementation) so it has a long time that
> the CPUs can be used effectively to generate more compressed data than
> before.

One thing to try, to explain Peter's worry, would be, for testing, to
add a counter to see how often this case triggers, and perhaps add
some debug to see when;  Peter's right that flipping between the
RAMBlocks seems odd, unless you're either doing lots of iterations or
have lots of separate RAMBlocks for some reason.

Dave

> > Btw, about the numbers: IMHO the numbers might not be really "true
> > numbers".  Or say, even the bandwidth is doubled, IMHO it does not
> > mean the performance is doubled. Becasue the data has changed.
> > 
> > Previously there were only compressed pages, and now for each cycle of
> > RAMBlock looping we'll send a normal page (then we'll get more thing
> > to send).  So IMHO we don't really know whether we sent more pages
> > with this patch, we can only know we sent more bytes (e.g., an extreme
> > case is that the extra 25Mbps/s are all caused by those normal pages,
> > and we can be sending exactly the same number of pages like before, or
> > even worse?).
> > 
> 
> Current implementation uses CPU very ineffectively (it's our next work
> to be posted out) that the network is almost idle so posting more data
> out is a better choice,further more, migration thread plays a role for
> parallel, it'd better to make it fast.
> 
> > > 
> > > > 
> > > > Another follow-up question would be: have you measured how long time
> > > > needed to compress a 4k page, and how many time to send it?  I think
> > > > "sending the page" is not really meaningful considering that we just
> > > > put a page into the buffer (which should be extremely fast since we
> > > > don't really flush it every time), however I would be curious on how
> > > > slow would compressing a page be.
> > > 
> > > I haven't benchmark the performance of zlib, i think it is CPU intensive
> > > workload, particularly, there no compression-accelerator (e.g, QAT) on
> > > our production. BTW, we were using lzo instead of zlib which worked
> > > better for some workload.
> > 
> > Never mind. Good to know about that.
> > 
> > > 
> > > Putting a page into buffer should depend on the network, i,e, if the
> > > network is congested it should take long time. :)
> > 
> > Again, considering that I don't know much on compression (especially I
> > hardly used that) mine are only questions, which should not block your
> > patches to be either queued/merged/reposted when proper. :)
> 
> Yes, i see. The discussion can potentially raise a better solution.
> 
> Thanks for your comment, Peter!
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Xiao Guangrong <guangrong.xiao@gmail.com>
Cc: Peter Xu <peterx@redhat.com>,
	liang.z.li@intel.com, kvm@vger.kernel.org, quintela@redhat.com,
	mtosatti@redhat.com, Xiao Guangrong <xiaoguangrong@tencent.com>,
	qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/8] migration: stop compressing page in migration thread
Date: Tue, 27 Mar 2018 20:12:44 +0100	[thread overview]
Message-ID: <20180327191243.GK2837@work-vm> (raw)
In-Reply-To: <73e25db4-997f-0fbf-0c73-6589283c4005@gmail.com>

* Xiao Guangrong (guangrong.xiao@gmail.com) wrote:
> 
> 
> On 03/26/2018 05:02 PM, Peter Xu wrote:
> > On Thu, Mar 22, 2018 at 07:38:07PM +0800, Xiao Guangrong wrote:
> > > 
> > > 
> > > On 03/21/2018 04:19 PM, Peter Xu wrote:
> > > > On Fri, Mar 16, 2018 at 04:05:14PM +0800, Xiao Guangrong wrote:
> > > > > 
> > > > > Hi David,
> > > > > 
> > > > > Thanks for your review.
> > > > > 
> > > > > On 03/15/2018 06:25 PM, Dr. David Alan Gilbert wrote:
> > > > > 
> > > > > > >     migration/ram.c | 32 ++++++++++++++++----------------
> > > > > > 
> > > > > > Hi,
> > > > > >      Do you have some performance numbers to show this helps?  Were those
> > > > > > taken on a normal system or were they taken with one of the compression
> > > > > > accelerators (which I think the compression migration was designed for)?
> > > > > 
> > > > > Yes, i have tested it on my desktop, i7-4790 + 16G, by locally live migrate
> > > > > the VM which has 8 vCPUs + 6G memory and the max-bandwidth is limited to 350.
> > > > > 
> > > > > During the migration, a workload which has 8 threads repeatedly written total
> > > > > 6G memory in the VM. Before this patchset, its bandwidth is ~25 mbps, after
> > > > > applying, the bandwidth is ~50 mbps.
> > > > 
> > > > Hi, Guangrong,
> > > > 
> > > > Not really review comments, but I got some questions. :)
> > > 
> > > Your comments are always valuable to me! :)
> > > 
> > > > 
> > > > IIUC this patch will only change the behavior when last_sent_block
> > > > changed.  I see that the performance is doubled after the change,
> > > > which is really promising.  However I don't fully understand why it
> > > > brings such a big difference considering that IMHO current code is
> > > > sending dirty pages per-RAMBlock.  I mean, IMHO last_sent_block should
> > > > not change frequently?  Or am I wrong?
> > > 
> > > It's depends on the configuration, each memory-region which is ram or
> > > file backend has a RAMBlock.
> > > 
> > > Actually, more benefits comes from the fact that the performance & throughput
> > > of the multithreads has been improved as the threads is fed by the
> > > migration thread and the result is consumed by the migration
> > > thread.
> > 
> > I'm not sure whether I got your points - I think you mean that the
> > compression threads and the migration thread can form a better
> > pipeline if the migration thread does not do any compression at all.
> > 
> > I think I agree with that.
> > 
> > However it does not really explain to me on why a very rare event
> > (sending the first page of a RAMBlock, considering bitmap sync is
> > rare) can greatly affect the performance (it shows a doubled boost).
> > 
> 
> I understand it is trick indeed, but it is not very hard to explain.
> Multi-threads (using 8 CPUs in our test) keep idle for a long time
> for the origin code, however, after our patch, as the normal is
> posted out async-ly that it's extremely fast as you said (the network
> is almost idle for current implementation) so it has a long time that
> the CPUs can be used effectively to generate more compressed data than
> before.

One thing to try, to explain Peter's worry, would be, for testing, to
add a counter to see how often this case triggers, and perhaps add
some debug to see when;  Peter's right that flipping between the
RAMBlocks seems odd, unless you're either doing lots of iterations or
have lots of separate RAMBlocks for some reason.

Dave

> > Btw, about the numbers: IMHO the numbers might not be really "true
> > numbers".  Or say, even the bandwidth is doubled, IMHO it does not
> > mean the performance is doubled. Becasue the data has changed.
> > 
> > Previously there were only compressed pages, and now for each cycle of
> > RAMBlock looping we'll send a normal page (then we'll get more thing
> > to send).  So IMHO we don't really know whether we sent more pages
> > with this patch, we can only know we sent more bytes (e.g., an extreme
> > case is that the extra 25Mbps/s are all caused by those normal pages,
> > and we can be sending exactly the same number of pages like before, or
> > even worse?).
> > 
> 
> Current implementation uses CPU very ineffectively (it's our next work
> to be posted out) that the network is almost idle so posting more data
> out is a better choice,further more, migration thread plays a role for
> parallel, it'd better to make it fast.
> 
> > > 
> > > > 
> > > > Another follow-up question would be: have you measured how long time
> > > > needed to compress a 4k page, and how many time to send it?  I think
> > > > "sending the page" is not really meaningful considering that we just
> > > > put a page into the buffer (which should be extremely fast since we
> > > > don't really flush it every time), however I would be curious on how
> > > > slow would compressing a page be.
> > > 
> > > I haven't benchmark the performance of zlib, i think it is CPU intensive
> > > workload, particularly, there no compression-accelerator (e.g, QAT) on
> > > our production. BTW, we were using lzo instead of zlib which worked
> > > better for some workload.
> > 
> > Never mind. Good to know about that.
> > 
> > > 
> > > Putting a page into buffer should depend on the network, i,e, if the
> > > network is congested it should take long time. :)
> > 
> > Again, considering that I don't know much on compression (especially I
> > hardly used that) mine are only questions, which should not block your
> > patches to be either queued/merged/reposted when proper. :)
> 
> Yes, i see. The discussion can potentially raise a better solution.
> 
> Thanks for your comment, Peter!
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  parent reply	other threads:[~2018-03-27 19:12 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13  7:57 [PATCH 0/8] migration: improve and cleanup compression guangrong.xiao
2018-03-13  7:57 ` [Qemu-devel] " guangrong.xiao
2018-03-13  7:57 ` [PATCH 1/8] migration: stop compressing page in migration thread guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 10:25   ` Dr. David Alan Gilbert
2018-03-15 10:25     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-16  8:05     ` Xiao Guangrong
2018-03-16  8:05       ` [Qemu-devel] " Xiao Guangrong
2018-03-19 12:11       ` Dr. David Alan Gilbert
2018-03-19 12:11         ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-21  8:19       ` Peter Xu
2018-03-21  8:19         ` [Qemu-devel] " Peter Xu
2018-03-22 11:38         ` Xiao Guangrong
2018-03-22 11:38           ` [Qemu-devel] " Xiao Guangrong
2018-03-26  9:02           ` Peter Xu
2018-03-26  9:02             ` [Qemu-devel] " Peter Xu
2018-03-26 15:43             ` Xiao Guangrong
2018-03-26 15:43               ` [Qemu-devel] " Xiao Guangrong
2018-03-27  7:33               ` Peter Xu
2018-03-27  7:33                 ` [Qemu-devel] " Peter Xu
2018-03-27 19:12               ` Dr. David Alan Gilbert [this message]
2018-03-27 19:12                 ` Dr. David Alan Gilbert
2018-03-28  3:01   ` Wang, Wei W
2018-03-28  3:01     ` [Qemu-devel] " Wang, Wei W
2018-03-27 15:24     ` Xiao Guangrong
2018-03-27 15:24       ` [Qemu-devel] " Xiao Guangrong
2018-03-28  7:30       ` Wei Wang
2018-03-28  7:30         ` [Qemu-devel] " Wei Wang
2018-03-28  7:37         ` Peter Xu
2018-03-28  7:37           ` [Qemu-devel] " Peter Xu
2018-03-28  8:30           ` Wei Wang
2018-03-28  8:30             ` [Qemu-devel] " Wei Wang
2018-03-13  7:57 ` [PATCH 2/8] migration: stop allocating and freeing memory frequently guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 11:03   ` Dr. David Alan Gilbert
2018-03-15 11:03     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-16  8:19     ` Xiao Guangrong
2018-03-16  8:19       ` [Qemu-devel] " Xiao Guangrong
2018-03-19 10:54       ` Dr. David Alan Gilbert
2018-03-19 10:54         ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-19 12:11         ` Xiao Guangrong
2018-03-19 12:11           ` [Qemu-devel] " Xiao Guangrong
2018-03-19  1:49   ` [PATCH 2/8] migration: stop allocating and freeingmemory frequently jiang.biao2
2018-03-19  1:49     ` [Qemu-devel] " jiang.biao2
2018-03-19  4:03     ` Xiao Guangrong
2018-03-19  4:03       ` [Qemu-devel] " Xiao Guangrong
2018-03-19  4:48       ` [PATCH 2/8] migration: stop allocating andfreeingmemory frequently jiang.biao2
2018-03-19  4:48         ` [Qemu-devel] " jiang.biao2
2018-03-21  9:06   ` [PATCH 2/8] migration: stop allocating and freeing memory frequently Peter Xu
2018-03-21  9:06     ` [Qemu-devel] " Peter Xu
2018-03-22 11:57     ` Xiao Guangrong
2018-03-22 11:57       ` [Qemu-devel] " Xiao Guangrong
2018-03-27  7:07       ` Peter Xu
2018-03-27  7:07         ` [Qemu-devel] " Peter Xu
2018-03-13  7:57 ` [PATCH 3/8] migration: support to detect compression and decompression errors guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 11:29   ` Dr. David Alan Gilbert
2018-03-15 11:29     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-16  8:25     ` Xiao Guangrong
2018-03-16  8:25       ` [Qemu-devel] " Xiao Guangrong
2018-03-19  7:56   ` [PATCH 3/8] migration: support to detect compressionand " jiang.biao2
2018-03-19  7:56     ` [Qemu-devel] " jiang.biao2
2018-03-19  8:01     ` Xiao Guangrong
2018-03-19  8:01       ` [Qemu-devel] " Xiao Guangrong
2018-03-21 10:00   ` [PATCH 3/8] migration: support to detect compression and " Peter Xu
2018-03-21 10:00     ` [Qemu-devel] " Peter Xu
2018-03-22 12:03     ` Xiao Guangrong
2018-03-22 12:03       ` [Qemu-devel] " Xiao Guangrong
2018-03-27  7:22       ` Peter Xu
2018-03-27  7:22         ` [Qemu-devel] " Peter Xu
2018-03-26 19:42         ` Xiao Guangrong
2018-03-26 19:42           ` [Qemu-devel] " Xiao Guangrong
2018-03-27 11:17           ` Peter Xu
2018-03-27 11:17             ` [Qemu-devel] " Peter Xu
2018-03-27  1:20             ` Xiao Guangrong
2018-03-27  1:20               ` [Qemu-devel] " Xiao Guangrong
2018-03-28  0:43               ` [PATCH 3/8] migration: support to detectcompression " jiang.biao2
2018-03-28  0:43                 ` [Qemu-devel] " jiang.biao2
2018-03-27 14:35                 ` Xiao Guangrong
2018-03-27 14:35                   ` [Qemu-devel] " Xiao Guangrong
2018-03-28  3:03                   ` Peter Xu
2018-03-28  3:03                     ` [Qemu-devel] " Peter Xu
2018-03-28  4:08                     ` [PATCH 3/8] migration: support todetectcompression " jiang.biao2
2018-03-28  4:08                       ` [Qemu-devel] " jiang.biao2
2018-03-28  4:20                       ` Peter Xu
2018-03-28  4:20                         ` [Qemu-devel] " Peter Xu
2018-03-27 18:44                         ` Xiao Guangrong
2018-03-27 18:44                           ` [Qemu-devel] " Xiao Guangrong
2018-03-28  8:07                           ` [PATCH 3/8] migration: support todetectcompressionand " jiang.biao2
2018-03-28  8:07                             ` [Qemu-devel] " jiang.biao2
2018-03-13  7:57 ` [PATCH 4/8] migration: introduce control_save_page() guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 11:37   ` Dr. David Alan Gilbert
2018-03-15 11:37     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-16  8:52     ` Xiao Guangrong
2018-03-16  8:52       ` [Qemu-devel] " Xiao Guangrong
2018-03-27  7:47     ` Peter Xu
2018-03-27  7:47       ` [Qemu-devel] " Peter Xu
2018-03-13  7:57 ` [PATCH 5/8] migration: move calling control_save_page to the common place guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 11:47   ` Dr. David Alan Gilbert
2018-03-15 11:47     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-16  8:59     ` Xiao Guangrong
2018-03-16  8:59       ` [Qemu-devel] " Xiao Guangrong
2018-03-19 13:15       ` Dr. David Alan Gilbert
2018-03-19 13:15         ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-27 12:35   ` Peter Xu
2018-03-27 12:35     ` [Qemu-devel] " Peter Xu
2018-03-13  7:57 ` [PATCH 6/8] migration: move calling save_zero_page " guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 12:27   ` Dr. David Alan Gilbert
2018-03-15 12:27     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-27 12:49   ` Peter Xu
2018-03-27 12:49     ` [Qemu-devel] " Peter Xu
2018-03-13  7:57 ` [PATCH 7/8] migration: introduce save_normal_page() guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 12:30   ` Dr. David Alan Gilbert
2018-03-15 12:30     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-27 12:54   ` Peter Xu
2018-03-27 12:54     ` [Qemu-devel] " Peter Xu
2018-03-13  7:57 ` [PATCH 8/8] migration: remove ram_save_compressed_page() guangrong.xiao
2018-03-13  7:57   ` [Qemu-devel] " guangrong.xiao
2018-03-15 12:32   ` Dr. David Alan Gilbert
2018-03-15 12:32     ` [Qemu-devel] " Dr. David Alan Gilbert
2018-03-27 12:56   ` Peter Xu
2018-03-27 12:56     ` [Qemu-devel] " Peter Xu

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=20180327191243.GK2837@work-vm \
    --to=dgilbert@redhat.com \
    --cc=guangrong.xiao@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=liang.z.li@intel.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=xiaoguangrong@tencent.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.