<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 6, 2014 at 6:32 PM, Gilad Chaplik <span dir="ltr"><<a href="mailto:gchaplik@redhat.com" target="_blank">gchaplik@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">----- Original Message -----<br>
> From: "Liran Zelkha" <<a href="mailto:liran.zelkha@gmail.com">liran.zelkha@gmail.com</a>><br>
</div><div class="">> To: "Kobi Ianko" <<a href="mailto:kobi@redhat.com">kobi@redhat.com</a>><br>
> Cc: "Gilad Chaplik" <<a href="mailto:gchaplik@redhat.com">gchaplik@redhat.com</a>>, <a href="mailto:devel@linode01.ovirt.org">devel@linode01.ovirt.org</a>, "engine-devel" <<a href="mailto:engine-devel@ovirt.org">engine-devel@ovirt.org</a>><br>
</div><div class="">> Sent: Sunday, April 6, 2014 3:40:13 PM<br>
> Subject: Re: [Devel] [Engine-devel] vds_dynamic refactor<br>
><br>
</div><div class="">> On Sun, Apr 6, 2014 at 3:37 PM, Kobi Ianko <<a href="mailto:kobi@redhat.com">kobi@redhat.com</a>> wrote:<br>
><br>
> > Joining in...<br>
> > From my point of view, in real life a user should have that many VDSs on<br>
> > one Engine (from a DB point of view).<br>
> > Modern DB system handles tables with millions of records and many<br>
> > relations, Do we really have a performance issue here?<br>
> > We could prefer a more easy to maintain implantation in this case over DB<br>
> > performance<br>
> ><br>
> > Yes we do. We make many queries on the VDS view, which is a VERY complex<br>
> view.<br>
><br>
<br>
</div>Actually I quite agree with Kobi, what is the plan for VMs? why do we start with VDS...<br>
what is the biggest deploy do you know of?<br></blockquote><div>We start with VDS because in an idle system, with 200 hosts and several thousands VMs, this is what you get as the top queries against the database. Look at how many times getvds is called. </div>
<div><img src="cid:ii_1453828cdf3a8d5e" alt="Inline image 1" width="1085" height="87"><br></div><div>BTW - the second query is an example of abusing the dynamic query mechanism. The 4th query (an update command) is a set of useless update_vds_dynamic commands. </div>
<div><br></div><div>For reference, the explain plan of get VDS is something like this:</div><div> QUERY PLAN </div>
<div>-----------------------------------------------------------------------------------------------------------------------------------------------------------</div><div> Nested Loop (cost=9.30..46.75 rows=6 width=9060) (actual time=0.063..0.068 rows=1 loops=1)</div>
<div> Join Filter: (vds_static.vds_id = vds_statistics.vds_id)</div><div> -> Seq Scan on vds_statistics (cost=0.00..1.01 rows=1 width=109) (actual time=0.008..0.008 rows=1 loops=1)</div><div> -> Nested Loop (cost=9.30..45.64 rows=6 width=8983) (actual time=0.048..0.052 rows=1 loops=1)</div>
<div> Join Filter: (vds_groups.vds_group_id = vds_static.vds_group_id)</div><div> -> Nested Loop Left Join (cost=0.00..9.29 rows=1 width=1389) (actual time=0.013..0.013 rows=1 loops=1)</div><div> -> Seq Scan on vds_groups (cost=0.00..1.01 rows=1 width=1271) (actual time=0.003..0.003 rows=1 loops=1)</div>
<div> -> Index Scan using pk_storage_pool on storage_pool (cost=0.00..8.27 rows=1 width=134) (actual time=0.008..0.008 rows=1 loops=1)</div><div> Index Cond: (vds_groups.storage_pool_id = id)</div>
<div> -> Hash Right Join (cost=9.30..36.28 rows=6 width=7610) (actual time=0.033..0.037 rows=1 loops=1)</div><div> Hash Cond: (vds_spm_id_map.vds_id = vds_static.vds_id)</div><div> -> Seq Scan on vds_spm_id_map (cost=0.00..22.30 rows=1230 width=20) (actual time=0.003..0.003 rows=1 loops=1)</div>
<div> -> Hash (cost=9.29..9.29 rows=1 width=7606) (actual time=0.019..0.019 rows=1 loops=1)</div><div> Buckets: 1024 Batches: 1 Memory Usage: 2kB</div><div> -> Nested Loop (cost=0.00..9.29 rows=1 width=7606) (actual time=0.012..0.013 rows=1 loops=1)</div>
<div> -> Seq Scan on vds_dynamic (cost=0.00..1.01 rows=1 width=1895) (actual time=0.006..0.006 rows=1 loops=1)</div><div> -> Index Scan using pk_vds_static on vds_static (cost=0.00..8.27 rows=1 width=5711) (actual time=0.005..0.006 rows=1 loops=1)</div>
<div> Index Cond: (vds_id = vds_dynamic.vds_id)</div><div> Total runtime: 0.299 ms</div><div>(19 rows)</div><div><br></div><div>It's terrible. Adding any additional join will make this worse. Please don't add any more tables... </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5"><br>
> ><br>
> > ----- Original Message -----<br>
> > > From: "Gilad Chaplik" <<a href="mailto:gchaplik@redhat.com">gchaplik@redhat.com</a>><br>
> > > To: "Liran Zelkha" <<a href="mailto:liran.zelkha@gmail.com">liran.zelkha@gmail.com</a>><br>
> > > Cc: <a href="mailto:devel@linode01.ovirt.org">devel@linode01.ovirt.org</a>, "engine-devel" <<a href="mailto:engine-devel@ovirt.org">engine-devel@ovirt.org</a>><br>
> > > Sent: Sunday, April 6, 2014 3:32:26 PM<br>
> > > Subject: Re: [Devel] [Engine-devel] vds_dynamic refactor<br>
> > ><br>
> > > ----- Original Message -----<br>
> > > > From: "Liran Zelkha" <<a href="mailto:liran.zelkha@gmail.com">liran.zelkha@gmail.com</a>><br>
> > > > To: "Gilad Chaplik" <<a href="mailto:gchaplik@redhat.com">gchaplik@redhat.com</a>><br>
> > > > Cc: "Itamar Heim" <<a href="mailto:iheim@redhat.com">iheim@redhat.com</a>>, <a href="mailto:devel@linode01.ovirt.org">devel@linode01.ovirt.org</a>,<br>
> > > > "engine-devel" <<a href="mailto:engine-devel@ovirt.org">engine-devel@ovirt.org</a>><br>
> > > > Sent: Sunday, April 6, 2014 3:26:24 PM<br>
> > > > Subject: Re: [Engine-devel] vds_dynamic refactor<br>
> > > ><br>
> > > > On Sun, Apr 6, 2014 at 3:18 PM, Gilad Chaplik <<a href="mailto:gchaplik@redhat.com">gchaplik@redhat.com</a>><br>
> > wrote:<br>
> > > ><br>
> > > > > ----- Original Message -----<br>
> > > > > > From: "Itamar Heim" <<a href="mailto:iheim@redhat.com">iheim@redhat.com</a>><br>
> > > > > > To: "Liran Zelkha" <<a href="mailto:liran.zelkha@gmail.com">liran.zelkha@gmail.com</a>><br>
> > > > > > Cc: "Gilad Chaplik" <<a href="mailto:gchaplik@redhat.com">gchaplik@redhat.com</a>>,<br>
> > <a href="mailto:devel@linode01.ovirt.org">devel@linode01.ovirt.org</a>,<br>
> > > > > "engine-devel" <<a href="mailto:engine-devel@ovirt.org">engine-devel@ovirt.org</a>><br>
> > > > > > Sent: Sunday, April 6, 2014 11:33:12 AM<br>
> > > > > > Subject: Re: [Engine-devel] vds_dynamic refactor<br>
> > > > > ><br>
> > > > > > On 04/06/2014 11:32 AM, Liran Zelkha wrote:<br>
> > > > > > ><br>
> > > > > > ><br>
> > > > > > ><br>
> > > > > > > On Sun, Apr 6, 2014 at 11:22 AM, Itamar Heim <<a href="mailto:iheim@redhat.com">iheim@redhat.com</a><br>
> > > > > > > <mailto:<a href="mailto:iheim@redhat.com">iheim@redhat.com</a>>> wrote:<br>
> > > > > > ><br>
> > > > > > > On 04/03/2014 07:51 PM, Liran Zelkha wrote:<br>
> > > > > > ><br>
> > > > > > > The problem is with both updates and selects.<br>
> > > > > > > For selects - to get all the information for the VDS we<br>
> > have<br>
> > > > > > > multiple<br>
> > > > > > > joins. Adding another one will hurt performance even<br>
> > more.<br>
> > > > > > > For updates - we have vds_static thats hardly changed.<br>
> > > > > > > vds_statistics<br>
> > > > > > > that changes all the time. vds_dynamic is not changed<br>
> > allot -<br>
> > > > > but<br>
> > > > > > > is<br>
> > > > > > > updated all the time because of the status. I think it's<br>
> > best<br>
> > > > > to<br>
> > > > > > > split<br>
> > > > > > > it to the two existing tables (BTW - relevant for VM as<br>
> > well)<br>
> > > > > > ><br>
> > > > > > ><br>
> > > > > > > but we don't update it unless the status has changed, which<br>
> > is a<br>
> > > > > > > rare occurance?<br>
> > > > > > ><br>
> > > > > > > Actually - no. We can definitely see times we are updating<br>
> > > > > > > vds_dynamic<br>
> > > > > > > with no reason at all. I tried to create patches for that - but<br>
> > it<br>
> > > > > > > happens from many different places in the code.<br>
> > > > > ><br>
> > > > > > what would be updated vds_dyanmic for status not originating in<br>
> > update<br>
> > > > > > run time info?<br>
> > > > ><br>
> > > > > We have separate DB flows for that (updateStatus and<br>
> > > > > updatePartialVdsDynamicCalc and more in VdsDynamicDAODbFacadeImpl).<br>
> > > > > A question: do you know if we update status in updateVdsDynamic? :-)<br>
> > not<br>
> > > > > sure but I found a possible race for pending resources (cpu, mem),<br>
> > LOL<br>
> > > > > :-)<br>
> > > > ><br>
> > > > > I think we do but not sure. Will check.<br>
> > ><br>
> > > Of course it is, that was a rhetorical question :-) (a lot of emoticons<br>
> > and<br>
> > > LOLs ;-))<br>
> > ><br>
> > > ><br>
> > > ><br>
> > > > > Still holds my original thought for having vds_on_boot.<br>
> > > > ><br>
> > > > ><br>
> > > > ><br>
> > > > Let's talk f2f on Tuesday?<br>
> > ><br>
> > > I'd prefer to reach conclusions here, I'd like everyone to be involved<br>
> > in a<br>
> > > root issue like this one.<br>
> ><br>
><br>
> What is the update frequency of this field?<br>
><br>
<br>
</div></div>which field?<br>
status? pending resources? on boot fields?<br>
iinm, status is updated mostly by user actions, at least in positive scenarios, and not that often.<br>
<div class=""><div class="h5"><br>
<br>
> > ><br>
> > > ><br>
> > > _______________________________________________<br>
> > > Devel mailing list<br>
> > > <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
> > > <a href="http://lists.ovirt.org/mailman/listinfo/devel" target="_blank">http://lists.ovirt.org/mailman/listinfo/devel</a><br>
> > ><br>
> ><br>
><br>
</div></div></blockquote></div><br></div></div>