<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 24, 2015 at 9:15 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"><span class="">On 11/24/2015 01:40 PM, John Hunter wrote:<br>
> Hi,<br>
><br>
> On Tue, Nov 24, 2015 at 5:18 PM, Oved Ourfali <<a href="mailto:oourfali@redhat.com">oourfali@redhat.com</a><br>
</span><span class="">> <mailto:<a href="mailto:oourfali@redhat.com">oourfali@redhat.com</a>>> wrote:<br>
><br>
> Hi<br>
><br>
> I discussed it with Juan (cc-ed).<br>
><br>
> There used to be a bug in the JDBC authenticion extension that<br>
> artificially delayed RESTAPI responses by 5 seconds:<br>
><br>
> brute force prevention login delay should not be applied to successful<br>
> login requests<br>
> <a href="https://bugzilla.redhat.com/1255814" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/1255814</a><br>
><br>
> That matches the description of the issue, but in theory it has been<br>
> fixed. I would suggest him to check that he is using the right version<br>
> of the extension.<br>
><br>
> I did not use the extension ovirt-engine-extension-aaa-jdbc, and I don't<br>
> think this bug matches my problem, because even there is only one line<br>
> in the python script, it still cost like 3 seconds, I don't think this is a<br>
> reasonable time as when I import other package, it cost almost no time.<br>
><br>
> Can you explain why this import line costs so much time?<br>
><br>
<br>
</span>If you are using 3.6 then you are using ovirt-engine-extension-aaa-jdbc,<br>
as it is enabled by default, but looks like it isn't related to your<br>
problem.<br>
<br>
That line takes a long time to execute because it has to process two<br>
large Python modules: the "params" module that contains a class per each<br>
type used by the API (393 classes) and the "brokers" module that<br>
contains a class per each resource used by the API (358 classes). That<br>
makes a total of 751 classes. In my environment it takes 0.9 seconds,<br>
approx. You may want to use the python profile in your environment and<br>
share the results:<br>
<br>
$ cat > profile.py <<.<br>
import cProfile<br>
cProfile.run("from ovirtsdk.api import API")<br>
.<br>
<br>
$ python profile.py<br>
<br>
I won't be surprised to see this taking those 3 seconds in a slower<br>
environment.<br>
<br>
But even if this takes those 3 seconds it shouldn't be a big problem,<br>
because you shouldn't be running that "from ... import ..." line<br>
frequently. Your program should do this once only, when it starts.<br>
<span class=""><br></span></blockquote><div>Assume that I have two functions to implement, one is to list all the vms belong</div><div>to the user, and the other is to retrieve one vm's virt-viewer connection file, as </div><div>far as I can see, I have to write two python scripts and import the ovirtsdk.api in both</div><div>scripts, each script has to take the 3 seconds :(</div><div><br></div><div>How can I run the "from ... import ..." just once ?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
><br>
> In addition we also know that retrieving large lists of objects with the<br>
> SDK is slow:<br>
><br>
> [RFE][performance] - generate large scale list running to slow.<br>
> <a href="https://bugzilla.redhat.com/1221238" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/1221238</a><br>
><br>
> We don't have a solution for that yet.<br>
><br>
> CC-ing Juan in case you have additional questions.<br>
><br>
><br>
> On Mon, Nov 23, 2015 at 11:27 AM, John Hunter <<a href="mailto:zhjwpku@gmail.com">zhjwpku@gmail.com</a><br>
</span><span class="">> <mailto:<a href="mailto:zhjwpku@gmail.com">zhjwpku@gmail.com</a>>> wrote:<br>
><br>
> Hi guys,<br>
><br>
> I am using the ovirt-engine-sdk-python to communicate with the<br>
> ovirt-engine,<br>
> I am ok to list the vms but the processing time is too long,<br>
> like 4.5 seconds,<br>
> and this line:<br>
> from ovirtsdk.api import API<br>
> take almost 3 seconds.<br>
><br>
> This seems a little bit longer than I expected it to be, so I am<br>
> asking is there<br>
> a quicker way to communicate with the ovirt-engine?<br>
><br>
<br>
--<br>
</span>Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
3ºD, 28016 Madrid, Spain<br>
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Best regards<br></div><div>Junwang Zhao</div><div>Department of Computer Science &Technology</div><div>Peking University</div><div>Beijing, 100871, PRC</div></div></div></div></div>
</div></div>