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