qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 0/3] fast qom tree get
@ 2025-07-10 16:24 Steve Sistare
  2025-07-10 16:24 ` [PATCH V4 1/3] qom: qom-list-get Steve Sistare
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Steve Sistare @ 2025-07-10 16:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Cleber Rosa, Eric Blake, Markus Armbruster,
	Paolo Bonzini, Daniel P. Berrange, Eduardo Habkost, Fabiano Rosas,
	Laurent Vivier, Philippe Mathieu-Daude, Steve Sistare

Using qom-list and qom-get to get all the nodes and property values in a
QOM tree can take multiple seconds because it requires 1000's of individual
QOM requests.  Some managers fetch the entire tree or a large subset
of it when starting a new VM, and this cost is a substantial fraction of
start up time.

To reduce this cost, consider QAPI calls that fetch more information in
each call:
  * qom-list-get-one: given a path, return a list of properties and values.
  * qom-list-get: given a list of paths, return a list of properties and
    values for each path.
  * qom-tree-get: given a path, return all descendant nodes rooted at that
    path, with properties and values for each.

In all cases, a returned property is represented by ObjectPropertyValue,
with fields name, type, and value.  If an error occurs when reading a value
the value field is omitted.  Thus an error for one property will not cause a
bulk fetch operation to fail.

To evaluate each method, I modified scripts/qmp/qom-tree to use the method,
verified all methods produce the same output, and timed each using:

  qemu-system-x86_64 -display none \
    -chardev socket,id=monitor0,path=/tmp/vm1.sock,server=on,wait=off \
    -mon monitor0,mode=control &

  time qom-tree -s /tmp/vm1.sock > /dev/null

I only measured once per method, but the variation is low after a warm up run.
The 'real - user - sys' column is a proxy for QEMU CPU time.

method               real(s)   user(s)   sys(s)  (real - user - sys)(s)
qom-list / qom-get   2.048     0.932     0.057   1.059
qom-list-get-one     0.402     0.230     0.029   0.143
qom-list-get         0.200     0.132     0.015   0.053
qom-tree-get         0.143     0.123     0.012   0.008

qom-tree-get is the fastest, reducing elapsed time by a factor of 14X,
and reducing QEMU CPU time by 132X.

qom-list-get is slower when fetching the entire tree, but can beat
qom-tree-get when only a subset of the tree needs to be fetched (not shown).
To keep things simple, provide only qom-list-get.

Changes in V4:
  * renamed qom-list-getv -> qom-list-get
  * expanded the qtest to verify a value
  * cosmetic changes in the docs
  * expanded the qom-list-get commit message

Changes in V3:
  * dropped qom-tree-get
  * modified the qom-tree script to use qom-list-getv
  * cosmetic changes in the docs and code.

Changes in V2:
  * removed "qom: qom_resolve_path", which was pulled separately
  * dropped the error member
  * fixed missing _list_tree in qom.py
  * updated 10.0 to 10.1

Steve Sistare (3):
  qom: qom-list-get
  python: use qom-list-get
  tests/qtest/qom-test: unit test for qom-list-getv

 python/qemu/utils/qom.py        |  43 ++++++++-------
 python/qemu/utils/qom_common.py |  53 ++++++++++++++++++
 qapi/qom.json                   |  50 +++++++++++++++++
 qom/qom-qmp-cmds.c              |  53 ++++++++++++++++++
 tests/qtest/qom-test.c          | 116 +++++++++++++++++++++++++++++++++++++++-
 5 files changed, 296 insertions(+), 19 deletions(-)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-08-08 16:17 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 16:24 [PATCH V4 0/3] fast qom tree get Steve Sistare
2025-07-10 16:24 ` [PATCH V4 1/3] qom: qom-list-get Steve Sistare
2025-07-11 14:35   ` Markus Armbruster
2025-07-11 15:22     ` Steven Sistare
2025-07-10 16:24 ` [PATCH V4 2/3] python: use qom-list-get Steve Sistare
2025-07-11 14:47   ` Markus Armbruster
2025-07-11 15:23     ` Steven Sistare
2025-07-11 16:50       ` Markus Armbruster
2025-07-11 17:08         ` Steven Sistare
2025-07-15 17:27     ` John Snow
2025-07-16  8:32       ` Markus Armbruster
2025-08-07 22:04         ` John Snow
2025-08-08  6:28           ` Markus Armbruster
2025-08-08 16:16             ` John Snow
2025-07-10 16:24 ` [PATCH V4 3/3] tests/qtest/qom-test: unit test for qom-list-getv Steve Sistare
2025-07-11 15:02   ` Markus Armbruster
2025-07-11 15:23     ` Steven Sistare
2025-07-11 15:06 ` [PATCH V4 0/3] fast qom tree get Markus Armbruster
2025-07-11 15:27   ` Steven Sistare

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).