All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
	qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, marcandre.lureau@redhat.com,
	pbonzini@redhat.com, kwolf@redhat.com, mreitz@redhat.com,
	armbru@redhat.com, dgilbert@redhat.com, den@openvz.org
Subject: Re: [PATCH v2 2/2] monitor: increase amount of data for monitor to read
Date: Tue, 24 Nov 2020 14:03:13 +0300	[thread overview]
Message-ID: <edb0cc5c-62e6-7277-59ae-e49e721fa596@virtuozzo.com> (raw)
In-Reply-To: <1606146274-246154-3-git-send-email-andrey.shinkevich@virtuozzo.com>

23.11.2020 18:44, Andrey Shinkevich wrote:
> QMP and HMP monitors read one byte at a time from the socket or stdin,
> which is very inefficient. With 100+ VMs on the host, this results in
> multiple extra system calls and CPU overuse.
> This patch increases the amount of read data up to 4096 bytes that fits
> the buffer size on the channel level.
> A JSON little parser is introduced to throttle QMP commands read from
> the buffer so that incoming requests do not overflow the monitor input
> queue.
> 
> Suggested-by: Denis V. Lunev<den@openvz.org>
> Signed-off-by: Andrey Shinkevich<andrey.shinkevich@virtuozzo.com>


Can't we just increase qmp queue instead? It seems a lot simpler:

diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 348bfad3d5..7e721eee3f 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -8,7 +8,7 @@
  typedef struct MonitorHMP MonitorHMP;
  typedef struct MonitorOptions MonitorOptions;
  
-#define QMP_REQ_QUEUE_LEN_MAX 8
+#define QMP_REQ_QUEUE_LEN_MAX 4096
  
  extern QemuOptsList qemu_mon_opts;
  
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 84222cd130..1588f00306 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -566,7 +566,7 @@ int monitor_can_read(void *opaque)
  {
      Monitor *mon = opaque;
  
-    return !qatomic_mb_read(&mon->suspend_cnt);
+    return !qatomic_mb_read(&mon->suspend_cnt) ? 4096 : 0;
  }


- with this patch tests pass and performance is even better.


-- 
Best regards,
Vladimir


  reply	other threads:[~2020-11-24 11:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 15:44 [PATCH v2 0/2] Increase amount of data for monitor to read Andrey Shinkevich via
2020-11-23 15:44 ` [PATCH v2 1/2] iotests: add another bash sleep command to 247 Andrey Shinkevich via
2020-11-24 10:04   ` Vladimir Sementsov-Ogievskiy
2020-11-24 12:08     ` Andrey Shinkevich
2020-11-25 10:35       ` Dr. David Alan Gilbert
2020-11-24 12:29   ` Andrey Shinkevich
2020-11-23 15:44 ` [PATCH v2 2/2] monitor: increase amount of data for monitor to read Andrey Shinkevich via
2020-11-24 11:03   ` Vladimir Sementsov-Ogievskiy [this message]
2020-11-24 15:04     ` Vladimir Sementsov-Ogievskiy
2020-11-27 13:35     ` Andrey Shinkevich
2020-11-23 16:55 ` [PATCH v2 0/2] Increase " Andrey Shinkevich
2020-11-23 17:13 ` Andrey Shinkevich

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=edb0cc5c-62e6-7277-59ae-e49e721fa596@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=andrey.shinkevich@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=dgilbert@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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.