From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>,
qemu-devel@nongnu.org, den@virtuozzo.com
Subject: Re: [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to read
Date: Wed, 10 Jul 2019 17:36:10 +0100 [thread overview]
Message-ID: <20190710163610.GG2682@work-vm> (raw)
In-Reply-To: <87lfxfy67u.fsf@dusky.pond.sub.org>
* Markus Armbruster (armbru@redhat.com) wrote:
> Did this fall through the cracks?
>
> Denis Plotnikov <dplotnikov@virtuozzo.com> writes:
>
> > Right now QMP and HMP monitors read 1 byte at a time from the socket, which
> > is very inefficient. With 100+ VMs on the host this easily reasults in
> > a lot of unnecessary system calls and CPU usage in the system.
>
> Yes, reading one byte at a time is awful. But QMP is control plane; I
> didn't expect it to impact system performance. How are you using QMP?
> Just curious, not actually opposed to improving QMP efficiency.
>
> > This patch changes the amount of data to read to 4096 bytes, which matches
> > buffer size on the channel level. Fortunately, monitor protocol is
> > synchronous right now thus we should not face side effects in reality.
> >
> > Signed-off-by: Denis V. Lunev <den@openvz.org>
> > Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
> > ---
> > include/monitor/monitor.h | 2 +-
> > monitor.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
> > index c1b40a9cac..afa1ed34a4 100644
> > --- a/include/monitor/monitor.h
> > +++ b/include/monitor/monitor.h
> > @@ -14,7 +14,7 @@ extern __thread Monitor *cur_mon;
> > #define MONITOR_USE_CONTROL 0x04
> > #define MONITOR_USE_PRETTY 0x08
> >
> > -#define QMP_REQ_QUEUE_LEN_MAX 8
> > +#define QMP_REQ_QUEUE_LEN_MAX 4096
>
> This looks suspicious. It's a request count, not a byte count. Can you
> explain what led you to change it this way?
>
> >
> > bool monitor_cur_is_qmp(void);
> >
> > diff --git a/monitor.c b/monitor.c
> > index 4807bbe811..a08e020b61 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -4097,7 +4097,7 @@ static int monitor_can_read(void *opaque)
> > {
> > Monitor *mon = opaque;
> >
> > - return !atomic_mb_read(&mon->suspend_cnt);
> > + return !atomic_mb_read(&mon->suspend_cnt) ? 4096 : 0;
> > }
> >
> > /*
>
> The ramifications are not obvious to me. I think I need to (re-)examine
> how QMP reads input, with special consideration to its OOB feature.
Yeh that was the bit that worried me; I also wondered what happens with
monitor_suspend and things like fd passing; enough to make it
non-obvious to me.
Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2019-07-10 16:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 10:59 [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to read Denis Plotnikov
2019-07-03 6:36 ` Markus Armbruster
2019-07-03 7:18 ` Denis Lunev
2019-07-10 16:36 ` Dr. David Alan Gilbert [this message]
2020-11-24 15:44 ` Vladimir Sementsov-Ogievskiy
2021-03-02 17:06 ` Vladimir Sementsov-Ogievskiy
2021-03-05 14:10 ` Markus Armbruster
2021-03-05 14:47 ` Vladimir Sementsov-Ogievskiy
2021-03-05 16:13 ` Markus Armbruster
2021-03-05 16:20 ` Vladimir Sementsov-Ogievskiy
2021-03-06 7:15 ` Markus Armbruster
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=20190710163610.GG2682@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=den@virtuozzo.com \
--cc=dplotnikov@virtuozzo.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).