Delay difference between queries (Python vs REST)

This is a multi-part message in MIME format. --------------C6E76C7C8FD43701D7C93416 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using two methods : _*Python SDK :*_ *from ovirtsdk.xml import params from ovirtsdk.api import API api = API(url='https://engine.fqdn/ovirt-engine/api', username='admin@internal', password='xxx', insecure=True) print len(api.vms.list())* time ./getMvm.py 62 real 0m23.016s user 0m22.288s sys 0m0.054s _*REST :*_ *time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: false" -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms* (Then grep or anything that would get the values from the xml returned.) real 0m0.383s user 0m0.036s sys 0m0.038s I am a beginner in both methods, but I would prefer play with Python. I'm very surprised to have to wait more than 20 seconds to get an answer. Looking at the engine log, I see that the authentication part is finished after say 3 seconds, then 20 seconds with absolutely no error message, no CPU load, no RAM burst, no nothing. On the SPM, exactly triple null nothing nada niet void is obviously explaining such a delay. I'm wondering if this super hyper sluggishness is somewhat related to the GUI global slowness I'm experiencing like other users since we left 3.2.x, and I would love that some oVirt ninja uses the comparison above to tell what parts in oVirt is used or not that could explain such a difference (database, access to SPM, LVM, network access, whatever...) -- Nicolas ECARNOT --------------C6E76C7C8FD43701D7C93416 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body bgcolor="#FFFFFF" text="#000000"> Hello,<br> <br> On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using two methods :<br> <br> <u><b><font size="+1">Python SDK :</font></b></u><br> <br> <b><font face="Courier New, Courier, monospace">from ovirtsdk.xml import params<br> from ovirtsdk.api import API <br> api = API(url='<a class="moz-txt-link-freetext" href="https://engine.fqdn/ovirt-engine/api">https://engine.fqdn/ovirt-engine/api</a>', username='admin@internal', password='xxx', insecure=True)<br> print len(api.vms.list())</font></b><br> <br> time ./getMvm.py <br> 62<br> <br> real 0m23.016s<br> user 0m22.288s<br> sys 0m0.054s<br> <br> <br> <u><b><font size="+1">REST :</font></b></u><br> <br> <b><font face="Courier New, Courier, monospace">time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: false" -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u 'admin@internal:xxx' <a class="moz-txt-link-freetext" href="https://">https://</a></font></b><b><font face="Courier New, Courier, monospace"><b><font face="Courier New, Courier, monospace">engine.fqdn</font></b>/ovirt-engine/api/vms</font></b><br> <br> (Then grep or anything that would get the values from the xml returned.)<br> <br> real 0m0.383s<br> user 0m0.036s<br> sys 0m0.038s<br> <br> <br> I am a beginner in both methods, but I would prefer play with Python. I'm very surprised to have to wait more than 20 seconds to get an answer.<br> Looking at the engine log, I see that the authentication part is finished after say 3 seconds, then 20 seconds with absolutely no error message, no CPU load, no RAM burst, no nothing.<br> On the SPM, exactly triple null nothing nada niet void is obviously explaining such a delay.<br> <br> I'm wondering if this super hyper sluggishness is somewhat related to the GUI global slowness I'm experiencing like other users since we left 3.2.x, and I would love that some oVirt ninja uses the comparison above to tell what parts in oVirt is used or not that could explain such a difference (database, access to SPM, LVM, network access, whatever...)<br> <br> -- <br> Nicolas ECARNOT<br> </body> </html> --------------C6E76C7C8FD43701D7C93416--

On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
Hello,
On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using two methods :
_*Python SDK :*_
*from ovirtsdk.xml import params from ovirtsdk.api import API api = API(url='https://engine.fqdn/ovirt-engine/api', username='admin@internal', password='xxx', insecure=True) print len(api.vms.list())*
time ./getMvm.py 62
real 0m23.016s user 0m22.288s sys 0m0.054s
_*REST :*_
*time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: false" -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms*
(Then grep or anything that would get the values from the xml returned.)
real 0m0.383s user 0m0.036s sys 0m0.038s
I am a beginner in both methods, but I would prefer play with Python. I'm very surprised to have to wait more than 20 seconds to get an answer. Looking at the engine log, I see that the authentication part is finished after say 3 seconds, then 20 seconds with absolutely no error message, no CPU load, no RAM burst, no nothing. On the SPM, exactly triple null nothing nada niet void is obviously explaining such a delay.
I'm wondering if this super hyper sluggishness is somewhat related to the GUI global slowness I'm experiencing like other users since we left 3.2.x, and I would love that some oVirt ninja uses the comparison above to tell what parts in oVirt is used or not that could explain such a difference (database, access to SPM, LVM, network access, whatever...)
-- Nicolas ECARNOT
The performance problem is inside version 3 of the Python SDK. That is one of the reasons that we had to do a new version of the Python SDK for version 4 of the engine. If you are using version 4 of the engine then you can use version 4 of the SDK: https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.... It should be much faster. Would be nice if you can repeat your test and report the results.

Le 17/01/2017 à 16:26, Juan Hernández a écrit :
On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
Hello,
On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using two methods :
_*Python SDK :*_
*from ovirtsdk.xml import params from ovirtsdk.api import API api = API(url='https://engine.fqdn/ovirt-engine/api', username='admin@internal', password='xxx', insecure=True) print len(api.vms.list())*
time ./getMvm.py 62
real 0m23.016s user 0m22.288s sys 0m0.054s
_*REST :*_
*time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: false" -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms*
(Then grep or anything that would get the values from the xml returned.)
real 0m0.383s user 0m0.036s sys 0m0.038s
I am a beginner in both methods, but I would prefer play with Python. I'm very surprised to have to wait more than 20 seconds to get an answer. Looking at the engine log, I see that the authentication part is finished after say 3 seconds, then 20 seconds with absolutely no error message, no CPU load, no RAM burst, no nothing. On the SPM, exactly triple null nothing nada niet void is obviously explaining such a delay.
I'm wondering if this super hyper sluggishness is somewhat related to the GUI global slowness I'm experiencing like other users since we left 3.2.x, and I would love that some oVirt ninja uses the comparison above to tell what parts in oVirt is used or not that could explain such a difference (database, access to SPM, LVM, network access, whatever...)
-- Nicolas ECARNOT
The performance problem is inside version 3 of the Python SDK. That is one of the reasons that we had to do a new version of the Python SDK for version 4 of the engine. If you are using version 4 of the engine then you can use version 4 of the SDK:
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms....
It should be much faster. Would be nice if you can repeat your test and report the results.
Hello Juan, Indeed, you were right. I tried the same from a recent server with a recent SDK, and I let you have a look : # rpm -q python-ovirt-engine-sdk4 python-ovirt-engine-sdk4-4.0.1-1.el7.centos.x86_64 # time ./getMvm.py 62 real 0m1.004s user 0m0.234s sys 0m0.031s And repeating the same test gives a very decent average, so thank you. -- Nicolas ECARNOT

On 01/17/2017 04:59 PM, Nicolas Ecarnot wrote:
Le 17/01/2017 à 16:26, Juan Hernández a écrit :
On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
Hello,
On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using two methods :
_*Python SDK :*_
*from ovirtsdk.xml import params from ovirtsdk.api import API api = API(url='https://engine.fqdn/ovirt-engine/api', username='admin@internal', password='xxx', insecure=True) print len(api.vms.list())*
time ./getMvm.py 62
real 0m23.016s user 0m22.288s sys 0m0.054s
_*REST :*_
*time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: false" -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms*
(Then grep or anything that would get the values from the xml returned.)
real 0m0.383s user 0m0.036s sys 0m0.038s
I am a beginner in both methods, but I would prefer play with Python. I'm very surprised to have to wait more than 20 seconds to get an answer. Looking at the engine log, I see that the authentication part is finished after say 3 seconds, then 20 seconds with absolutely no error message, no CPU load, no RAM burst, no nothing. On the SPM, exactly triple null nothing nada niet void is obviously explaining such a delay.
I'm wondering if this super hyper sluggishness is somewhat related to the GUI global slowness I'm experiencing like other users since we left 3.2.x, and I would love that some oVirt ninja uses the comparison above to tell what parts in oVirt is used or not that could explain such a difference (database, access to SPM, LVM, network access, whatever...)
-- Nicolas ECARNOT
The performance problem is inside version 3 of the Python SDK. That is one of the reasons that we had to do a new version of the Python SDK for version 4 of the engine. If you are using version 4 of the engine then you can use version 4 of the SDK:
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms....
It should be much faster. Would be nice if you can repeat your test and report the results.
Hello Juan,
Indeed, you were right. I tried the same from a recent server with a recent SDK, and I let you have a look :
# rpm -q python-ovirt-engine-sdk4 python-ovirt-engine-sdk4-4.0.1-1.el7.centos.x86_64
# time ./getMvm.py 62
real 0m1.004s user 0m0.234s sys 0m0.031s
And repeating the same test gives a very decent average, so thank you.
Twenty times faster, approx, good to know. Thanks. By the way, if you want even better performance, then make sure to disable debug and enable compression: connection = sdk.Connection( ... debug=False, compress=True, )

On Tue, Jan 17, 2017 at 6:03 PM, Juan Hernández <jhernand@redhat.com> wrote:
On 01/17/2017 04:59 PM, Nicolas Ecarnot wrote:
Le 17/01/2017 à 16:26, Juan Hernández a écrit :
On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote:
Hello,
On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using two methods :
_*Python SDK :*_
*from ovirtsdk.xml import params from ovirtsdk.api import API api = API(url='https://engine.fqdn/ovirt-engine/api', username='admin@internal', password='xxx', insecure=True) print len(api.vms.list())*
time ./getMvm.py 62
real 0m23.016s user 0m22.288s sys 0m0.054s
_*REST :*_
*time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: false" -H "Accept: application/xml" -H "Content-Type: application/xml" -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt- engine/api/vms*
(Then grep or anything that would get the values from the xml returned.)
real 0m0.383s user 0m0.036s sys 0m0.038s
I am a beginner in both methods, but I would prefer play with Python. I'm very surprised to have to wait more than 20 seconds to get an answer. Looking at the engine log, I see that the authentication part is finished after say 3 seconds, then 20 seconds with absolutely no error message, no CPU load, no RAM burst, no nothing. On the SPM, exactly triple null nothing nada niet void is obviously explaining such a delay.
I'm wondering if this super hyper sluggishness is somewhat related to the GUI global slowness I'm experiencing like other users since we left 3.2.x, and I would love that some oVirt ninja uses the comparison above to tell what parts in oVirt is used or not that could explain such a difference (database, access to SPM, LVM, network access, whatever...)
-- Nicolas ECARNOT
The performance problem is inside version 3 of the Python SDK. That is one of the reasons that we had to do a new version of the Python SDK for version 4 of the engine. If you are using version 4 of the engine then you can use version 4 of the SDK:
https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
https://github.com/oVirt/ovirt-engine-sdk/blob/master/ sdk/examples/list_vms.py
It should be much faster. Would be nice if you can repeat your test and report the results.
Hello Juan,
Indeed, you were right. I tried the same from a recent server with a recent SDK, and I let you have a look :
# rpm -q python-ovirt-engine-sdk4 python-ovirt-engine-sdk4-4.0.1-1.el7.centos.x86_64
# time ./getMvm.py 62
real 0m1.004s user 0m0.234s sys 0m0.031s
And repeating the same test gives a very decent average, so thank you.
Twenty times faster, approx, good to know. Thanks. By the way, if you want even better performance, then make sure to disable debug and enable compression:
connection = sdk.Connection( ... debug=False, compress=True, )
Shouldn't it be the default? Y.
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

On 01/17/2017 08:42 PM, Yaniv Kaul wrote:
On Tue, Jan 17, 2017 at 6:03 PM, Juan Hernández <jhernand@redhat.com <mailto:jhernand@redhat.com>> wrote:
On 01/17/2017 04:59 PM, Nicolas Ecarnot wrote: > Le 17/01/2017 à 16:26, Juan Hernández a écrit : >> On 01/17/2017 03:56 PM, Nicolas Ecarnot wrote: >>> Hello, >>> >>> On a 3.6.5 DC, I'm trying to figure out how many VMs there are, using >>> two methods : >>> >>> _*Python SDK :*_ >>> >>> *from ovirtsdk.xml import params >>> from ovirtsdk.api import API >>> api = API(url='https://engine.fqdn/ovirt-engine/api <https://engine.fqdn/ovirt-engine/api>', >>> username='admin@internal', password='xxx', insecure=True) >>> print len(api.vms.list())* >>> >>> time ./getMvm.py >>> 62 >>> >>> real 0m23.016s >>> user 0m22.288s >>> sys 0m0.054s >>> >>> >>> _*REST :*_ >>> >>> *time curl -H "Version: 3" -H "Prefer: persistent-auth" -H "Filter: >>> false" -H "Accept: application/xml" -H "Content-Type: application/xml" >>> -k -u 'admin@internal:xxx' https://***engine.fqdn*/ovirt-engine/api/vms* >>> >>> (Then grep or anything that would get the values from the xml returned.) >>> >>> real 0m0.383s >>> user 0m0.036s >>> sys 0m0.038s >>> >>> >>> I am a beginner in both methods, but I would prefer play with Python. >>> I'm very surprised to have to wait more than 20 seconds to get an >>> answer. >>> Looking at the engine log, I see that the authentication part is >>> finished after say 3 seconds, then 20 seconds with absolutely no error >>> message, no CPU load, no RAM burst, no nothing. >>> On the SPM, exactly triple null nothing nada niet void is obviously >>> explaining such a delay. >>> >>> I'm wondering if this super hyper sluggishness is somewhat related to >>> the GUI global slowness I'm experiencing like other users since we left >>> 3.2.x, and I would love that some oVirt ninja uses the comparison above >>> to tell what parts in oVirt is used or not that could explain such a >>> difference (database, access to SPM, LVM, network access, whatever...) >>> >>> -- >>> Nicolas ECARNOT >>> >> >> The performance problem is inside version 3 of the Python SDK. That is >> one of the reasons that we had to do a new version of the Python SDK for >> version 4 of the engine. If you are using version 4 of the engine then >> you can use version 4 of the SDK: >> >> https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk <https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk> >> >> https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.... <https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py> >> >> >> It should be much faster. Would be nice if you can repeat your test and >> report the results. >> > > Hello Juan, > > Indeed, you were right. I tried the same from a recent server with a > recent SDK, and I let you have a look : > > # rpm -q python-ovirt-engine-sdk4 > python-ovirt-engine-sdk4-4.0.1-1.el7.centos.x86_64 > > # time ./getMvm.py > 62 > > real 0m1.004s > user 0m0.234s > sys 0m0.031s > > And repeating the same test gives a very decent average, so thank you. >
Twenty times faster, approx, good to know. Thanks. By the way, if you want even better performance, then make sure to disable debug and enable compression:
connection = sdk.Connection( ... debug=False, compress=True, )
Shouldn't it be the default? Y.
Debug is disabled by default, but in is enabled in almost all the examples. As I suggested an example I also suggest to makes sure to disable it. Compression is enabled by default in version 4.1 of the SDK, which isn't released yet. In version 4.0 it needs to be enabled explicitly.
participants (3)
-
Juan Hernández
-
Nicolas Ecarnot
-
Yaniv Kaul