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