------=_Part_23935490_2012384362.1403872214216
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Hi,
Due to the recent discussion (
http://gerrit.ovirt.org/#/c/28712/), and as part
of the ongoing focus on scalability and performances (
http://gerrit.ovirt.org/#/c/17694/
and many others),
I took the chance to do a very quick and dirty bench to see how it really cost
to do XML processing in sampling threads (thanks to Nir for the kickstart!), and,
in general, how much the XML processing costs.
Please find attached the test script and the example XML
(real one made by VDSM master on my RHEL6.5 box).
On my laptop:
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Model name: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
Stepping: 9
CPU MHz: 1359.375
CPU max MHz: 3600.0000
CPU min MHz: 1200.0000
BogoMIPS: 5786.91
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 4096K
NUMA node0 CPU(s): 0-3
8 GiBs of RAM, running GNOME desktop and the usual development stuff
xmlbench.py linuxvm1.xml MODE 300
MODE is either 'md' (minidom) or 'cet' (cElementTree).
This will run $NUMTHREADS threads fast and loose without synchronization.
We can actually have this behaviour if a customer just mass start VMs.
In general I expect some clustering of the sampling activity, not a nice evenly
interleaved
time sequence.
CPU measurement: just opened a terminal and run 'htop' on it.
CPU profile: clustered around the sampling interval. Usage negligible most of time, peak
on sampling as shown below
300 VMs
minidom: ~38% CPU
cElementTree: ~5% CPU
500 VMs
minidom: ~48% CPU
cElementTree: ~6% CPU
1000 VMs
python thread error :)
File "/usr/lib64/python2.7/threading.py", line 746, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread
I think this is another proof (if we need more of them) that
* we _really need_ to move away from the 1 thread per VM model ->
http://gerrit.ovirt.org/#/c/29189/ and friends! Let's fire up the discussion!
* we should move to cElementTree anyway in the near future: faster processing, scales
better, nicer API.
It is also a pet peeve of mine, I do have some patches floating but we need still some
preparation work in the virt package.
--
Francesco Romani
RedHat Engineering Virtualization R & D
Phone: 8261328
IRC: fromani
------=_Part_23935490_2012384362.1403872214216
Content-Type: text/x-python; name=xmlbench.py
Content-Disposition: attachment; filename=xmlbench.py
Content-Transfer-Encoding: base64
IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgppbXBvcnQgc3lzCmltcG9ydCB0aHJlYWRpbmcKaW1wb3J0
IHRpbWUKI2ltcG9ydCBseG1sLmV0cmVlCmltcG9ydCB4bWwuZG9tLm1pbmlkb20KaW1wb3J0IHht
bC5ldHJlZS5jRWxlbWVudFRyZWUKaW1wb3J0IHhtbC5ldHJlZS5FbGVtZW50VHJlZQoKCmNsYXNz
IFdvcmtlcih0aHJlYWRpbmcuVGhyZWFkKToKICAgIGRlZiBfX2luaXRfXyhzZWxmLCBmdW5jLCB4
bWwsIGRlbGF5LCBudW1ydW5zKToKICAgICAgICBzdXBlcihXb3JrZXIsIHNlbGYpLl9faW5pdF9f
KCkKICAgICAgICBzZWxmLmRhZW1vbiA9IFRydWUKICAgICAgICBzZWxmLmZ1bmMgPSBmdW5jCiAg
ICAgICAgc2VsZi54bWwgPSB4bWwKICAgICAgICBzZWxmLmRlbGF5ID0gZGVsYXkKICAgICAgICBz
ZWxmLm51bXJ1bnMgPSBudW1ydW5zCgogICAgZGVmIG11c3RnbyhzZWxmKToKICAgICAgICBpZiBz
ZWxmLm51bXJ1bnMgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHNlbGYubnVtcnVucyAtPSAxCiAg
ICAgICAgICAgIGlmIHNlbGYubnVtcnVucyA8PSAwOgogICAgICAgICAgICAgICAgcmV0dXJuIEZh
bHNlCiAgICAgICAgcmV0dXJuIFRydWUKCiAgICBkZWYgcnVuKHNlbGYpOgogICAgICAgIHByaW50
ICclcyBkZWxheT0laSBzdGFydGluZyEnICUoc2VsZi5uYW1lLCBz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KCkpCgpkZWYgX21haW4oYXJncyk6CiAgICBpZiBsZW4oYXJncykgPCAzOgog
ICAgICAgIF91c2FnZSgpCiAgICAgICAgc3lzLmV4aXQoMSkKICAgIGVsc2U6CiAgICAgICAgeG1s
cGF0aCA9IGFyZ3NbMF0KICAgICAgICBtb2RlID0gYXJnc1sxXQogICAgICAgIG50aHJlYWRzID0g
aW50KGFyZ3NbMl0pCiAgICAgICAgZGVsYXkgPSBpbnQoYXJnc1szXSkgaWYgbGVuKGFyZ3MpID4g
MyBlbHNlIDE1CiAgICAgICAgbnVtcnVucyA9IGFyZ3NbNF0gaWYgbGVuKGFyZ3MpID4gNCBlbHNl
IE5vbmUKICAgICAgICBpZiBtb2RlIG5vdCBpbiBQQVJTRVJTOgogICAgICAgICAgICBfdXNhZ2Uo
KQogICAgICAgICAgICBzeXMuZXhpdCgyKQogICAgICAgIHdpdGggb3Blbih4bWxwYXRoLCAncnQn
KSBhcyB4bWw6CiAgICAgICAgICAgIHJ1bm5lcih4bWwucmVhZCgpLCBtb2RlLCBudGhyZWFkcywg
ZGVsYXksIG51bXJ1bnMpCgppZiBfX25hbWVfXyA9PSAiX19tYWluX18iOgogICAgX21haW4oc3lz
LmFyZ3ZbMTpdKQo=
------=_Part_23935490_2012384362.1403872214216
Content-Type: application/xml; name=linuxvm1.xml
Content-Disposition: attachment; filename=linuxvm1.xml
Content-Transfer-Encoding: base64
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPGRvbWFpbiB0eXBlPSJrdm0i
PgogICAgICAgIDxuYW1lPkYyMF9DMTwvbmFtZT4KICAgICAgICA8dXVpZD41NmQxYzY1Ny1kZDc2
LTQ2MDktYTIwNy1jMDUwNjk5YmU1YmU8L3V1aWQ+CiAgICAgICAgPG1lbW9yeT40MTk0MzA0PC9t
ZW1vcnk+CiAgICAgICAgPGN1cnJlbnRNZW1vcnk+NDE5NDMwNDwvY3VycmVudE1lbW9yeT4KICAg
ICAgICA8dmNwdSBjdXJyZW50PSIyIj4xNjA8L3ZjcHU+CiAgICAgICAgPG1lbXR1bmU+CiAgICAg
ICAgICAgICAgICA8bWluX2d1YXJhbnRlZT4yMDk3MTUyPC9taW5fZ3VhcmFudGVlPgogICAgICAg
IDwvbWVtdHVuZT4KICAgICAgICA8ZGV2aWNlcz4KICAgICAgICAgICAgICAgIDxjaGFubmVsIHR5
cGU9InVuaXgiPgogICAgICAgICAgICAgICAgICAgICAgICA8dGFyZ2V0IG5hbWU9ImNvbS5yZWRo
YXQucmhldm0udmRzbSIgdHlwZT0idmlydGlvIi8+CiAgICAgICAgICAgICAgICAgICAgICAgIDxz
b3VyY2UgbW9kZT0iYmluZCIgcGF0aD0iL3Zhci9saWIvbGlidmlydC9xZW11L2NoYW5uZWxzLzU2
ZDFjNjU3LWRkNzYtNDYwOS1hMjA3LWMwNTA2OTliZTViZS5jb20ucmVkaGF0LnJoZXZtLnZkc20i
Lz4KICAgICAgICAgICAgICAgIDwvY2hhbm5lbD4KICAgICAgICAgICAgICAgIDxjaGFubmVsIHR5
cGU9InVuaXgiPgogICAgICAgICAgICAgICAgICAgICAgICA8dGFyZ2V0IG5hbWU9Im9yZy5xZW11
Lmd1ZXN0X2FnZW50LjAiIHR5cGU9InZpcnRpbyIvPgogICAgICAgICAgICAgICAgICAgICAgICA8
c291cmNlIG1vZGU9ImJpbmQiIHBhdGg9Ii92YXIvbGliL2xpYnZpcnQvcWVtdS9jaGFubmVscy81
NmQxYzY1Ny1kZDc2LTQ2MDktYTIwNy1jMDUwNjk5YmU1YmUub3JnLnFlbXUuZ3Vlc3RfYWdlbnQu
MCIvPgogICAgICAgICAgICAgICAgPC9jaGFubmVsPgogICAgICAgICAgICAgICAgPGlucHV0IGJ1
cz0icHMyIiB0eXBlPSJtb3VzZSIvPgogICAgICAgICAgICAgICAgPG1lbWJhbGxvb24gbW9kZWw9
InZpcnRpbyIvPgogICAgICAgICAgICAgICAgPHZpZGVvPgogICAgICAgICAgICAgICAgICAg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PgogICAgICAgICAgICAgICAgICAgICAgICA8Ym9v
dCBvcmRlcj0iMiIvPgogICAgICAgICAgICAgICAgICAgICAgICA8YmFuZHdpZHRoLz4KICAgICAg
ICAgICAgICAgIDwvaW50ZXJmYWNlPgogICAgICAgICAgICAgICAgPGRpc2sgZGV2aWNlPSJjZHJv
bSIgc25hcHNob3Q9Im5vIiB0eXBlPSJmaWxlIj4KICAgICAgICAgICAgICAgICAgICAgICAgPGFk
ZHJlc3MgYnVzPSIxIiBjb250cm9sbGVyPSIwIiB0YXJnZXQ9IjAiIHR5cGU9ImRyaXZlIiB1bml0
PSIwIi8+CiAgICAgICAgICAgICAgICAgICAgICAgIDxzb3VyY2UgZmlsZT0iIiBzdGFydHVwUG9s
aWN5PSJvcHRpb25hbCIvPgogICAgICAgICAgICAgICAgICAgICAgICA8dGFyZ2V0IGJ1cz0iaWRl
IiBkZXY9ImhkYyIvPgogICAgICAgICAgICAgICAgICAgICAgICA8cmVhZG9ubHkvPgogICAgICAg
ICAgICAgICAgICAgICAgICA8c2VyaWFsLz4KICAgICAgICAgICAgICAgIDwvZGlzaz4KICAgICAg
ICAgICAgICAgIDxkaXNrIGRldmljZT0iZGlzayIgc25hcHNob3Q9Im5vIiB0eXBlPSJibG9jayI+
CiAgICAgICAgICAgICAgICAgICAgICAgIDxhZGRyZXNzIGJ1cz0iMHgwMCIgZG9tYWluPSIweDAw
MDAiIGZ1bmN0aW9uPSIweDAiIHNsb3Q9IjB4MDUiIHR5cGU9InBjaSIvPgogICAgICAgICAgICAg
ICAgICAgICAgICA8c291cmNlIGRldj0iL3JoZXYvZGF0YS1jZW50ZXIvbW50L2Jsb2NrU0QvOGNl
YjgzOGEtNGU3NC00MjBkLWIxZTItODE3YzBlOWY4ZWVhL2ltYWdlcy9kNWVkMjZkNS0zZDM1LTRl
ZjgtYjUyYy1hNjVkOTllMTJhZDAvZGZmNjMxY2YtMTM1OC00Yjc0LTk3MzItNTYwODMyNjM0ODEw
Ii8+CiAgICAgICAgICAgICAgICAgICAgICAgIDx0YXJnZXQgYnVzPSJ2aXJ0aW8iIGRldj0idmRh
Ii8+CiAgICAgICAgICAgICAgICAgICAgICAgIDxzZXJpYWw+ZDVlZDI2ZDUtM2QzNS00ZWY4LWI1
MmMtYTY1ZDk5ZTEyYWQwPC9zZXJpYWw+CiAgICAgICAgICAgICAgICAgICAgICAgIDxib290IG9y
ZGVyPSIxIi8+CiAgICAgICAgICAgICAgICAgICAgICAgIDxkcml2ZXIgY2FjaGU9Im5vbmUiIGVy
cm9yX3BvbGljeT0ic3RvcCIgaW89Im5hdGl2ZSIgbmFtZT0icWVtdSIgdHlwZT0icWNvdzIiLz4K
ICAgICAgICAgICAgICAgIDwvZGlzaz4KICAgICAgICAgICAgICAgIDxjaGFubmVsIHR5cGU9InNw
aWNldm1jIj4KICAgICAgICAgICAgICAgICAgICAgICAgPHRhcmdldCBuYW1lPSJjb20ucmVkaGF0
LnNwaWNlLjAiIHR5cGU9InZpcnRpbyIvPgogICAgICAgICAgICAgICAgPC9jaGFubmVsPgogICAg
ICAgIDwvZGV2aWNlcz4KICAgICAgICA8b3M+CiAgICAgICAgICAgICAgICA8dHlwZSBhcmNoPSJ4
ODZfNjQiIG1hY2hpbmU9InJoZWw2LjUuMCI+aHZtPC90eXBlPgogICAgICAgICAgICAgICAgPHNt
YmlvcyBtb2RlPSJzeXNpbmZvIi8+CiAgICAgICAgPC9vcz4KICAgICAgICA8c3lzaW5mbyB0eXBl
PSJzbWJpb3MiPgogICAgICAgICAgICAgICAgPHN5c3RlbT4KICAgICAgICAgICAgICAgICAgICAg
ICAgPGVudHJ5IG5hbWU9Im1hbnVmYWN0dXJlciI+b1ZpcnQ8L2VudHJ5PgogICAgICAgICAgICAg
ICAgICAgICAgICA8ZW50cnkgbmFtZT0icHJvZHVjdCI+b1ZpcnQgTm9kZTwvZW50cnk+CiAgICAg
ICAgICAgICAgICAgICAgICAgIDxlbnRyeSBuYW1lPSJ2ZXJzaW9uIj42U2VydmVyLTYuNS4wLjEu
ZWw2PC9lbnRyeT4KICAgICAgICAgICAgICAgICAgICAgICAgPGVudHJ5IG5hbWU9InNlcmlhbCI+
NEM0QzQ1NDQtMDA1OS00NDEwLTgwNDMtQjZDMDRGNEU1QTMxXzEwOmZlOmVkOjAyOjAyOmU0PC9l
bnRyeT4KICAgICAgICAgICAgICAgICAgICAgICAgPGVudHJ5IG5hbWU9InV1aWQiPjU2ZDFjNjU3
LWRkNzYtNDYwOS1hMjA3LWMwNTA2OTliZTViZTwvZW50cnk+CiAgICAgICAgICAgICAgICA8L3N5
c3RlbT4KICAgICAgICA8L3N5c2luZm8+CiAgICAgICAgPGNsb2NrIGFkanVzdG1lbnQ9IjAiIG9m
ZnNldD0idmFyaWFibGUiPgogICAgICAgICAgICAgICAgPHRpbWVyIG5hbWU9InJ0YyIgdGlja3Bv
bGljeT0iY2F0Y2h1cCIvPgogICAgICAgICAgICAgICAgPHRpbWVyIG5hbWU9InBpdCIgdGlja3Bv
bGljeT0iZGVsYXkiLz4KICAgICAgICAgICAgICAgIDx0aW1lciBuYW1lPSJocGV0IiBwcmVzZW50
PSJubyIvPgogICAgICAgIDwvY2xvY2s+CiAgICAgICAgPGZlYXR1cmVzPgogICAgICAgICAgICAg
ICAgPGFjcGkvPgogICAgICAgIDwvZmVhdHVyZXM+CiAgICAgICAgPGNwdSBtYXRjaD0iZXhhY3Qi
PgogICAgICAgICAgICAgICAgPG1vZGVsPlNhbmR5QnJpZGdlPC9tb2RlbD4KICAgICAgICAgICAg
ICAgIDx0b3BvbG9neSBjb3Jlcz0iMSIgc29ja2V0cz0iMTYwIiB0aHJlYWRzPSIxIi8+CiAgICAg
ICAgPC9jcHU+CjwvZG9tYWluPgo=
------=_Part_23935490_2012384362.1403872214216--