These are chat archives for ManageIQ/manageiq/performance

10th
May 2016
Keenan Brock
@kbrock
May 10 2016 15:18
@Fryguy looking at Relationship, it looks like we download every associated model with another model. This is sure downloading a lot. any background would be great
Jason Frey
@Fryguy
May 10 2016 15:26
Relationship's purpose is to query a tree of data in as few queries as possible
Keenan Brock
@kbrock
May 10 2016 15:27
but we download everything, and then look for the class of interest
Jason Frey
@Fryguy
May 10 2016 15:27
If someone is "walking" the tree with it, then that is being done wrong
Keenan Brock
@kbrock
May 10 2016 15:27
using grep
Jason Frey
@Fryguy
May 10 2016 15:27
you mean the "of_type" bit?
Keenan Brock
@kbrock
May 10 2016 15:27
um, that is related
Jason Frey
@Fryguy
May 10 2016 15:27

but we download everything, and then look for the class of interest

can you give a specific example? I'm not sure what that means exactly

maybe in a gist or something?
Keenan Brock
@kbrock
May 10 2016 15:28
+1
will get gist
Jason Frey
@Fryguy
May 10 2016 15:29
high level idea is to query the tree via ancestry which are just references to other tables...then bundle those up into batches of single-queries, then rebuild the tree once we have all the records
much like how ActiveRecord preloading works
Keenan Brock
@kbrock
May 10 2016 15:29
yes
but we have to convert all those ancestry classes across to the actual objects
THEN we do stuff
Jason Frey
@Fryguy
May 10 2016 15:29
the caller doesn't have to unless they need the records themselves
Keenan Brock
@kbrock
May 10 2016 15:30
so we essentially loaded everything. when often we were only looking for hosts
Jason Frey
@Fryguy
May 10 2016 15:30
if the caller does .children, then it will do that
Keenan Brock
@kbrock
May 10 2016 15:30
ok, that sounds good
so if I find us downloading everything in other cases, then I found something
Jason Frey
@Fryguy
May 10 2016 15:30
if they call .child_ids then it won't go to the other tables because the information is already in the Relatonship table
so .child_ids will just return the [resource_type, resource_id] pairs that it sees directly
.child_rels is similar in that it returns Relationship records directly
Keenan Brock
@kbrock
May 10 2016 15:31
yea
I'll find spots where it is downloading everything
think one of the abstractions in there is doing too much
thanks
will gist
Jason Frey
@Fryguy
May 10 2016 15:31

so if I find us downloading everything in other cases, then I found something

Yeah, that would be an opportunity to see if it really needs to get the extra data

Keenan Brock
@kbrock
May 10 2016 15:32
in belongsto filter
it is downloading every object
Jason Frey
@Fryguy
May 10 2016 15:32
"of_type" is also a thing I put together to limit getting data
Keenan Brock
@kbrock
May 10 2016 15:32
yea, well
it is doing kind_of?() which requires loading the object to see if it should "load the object"
Jason Frey
@Fryguy
May 10 2016 15:32
so if you do .children("of_type" => "Host") then ideally it would filter the realtionships before going to get the real records
Keenan Brock
@kbrock
May 10 2016 15:33
ok
thanks
Jason Frey
@Fryguy
May 10 2016 15:33
oh really? then I think that's a bug, but I'd have to see the specific case
Keenan Brock
@kbrock
May 10 2016 15:33
no
don't take that for fact
I need to research
Jason Frey
@Fryguy
May 10 2016 15:33
k
Keenan Brock
@kbrock
May 10 2016 15:33
thanks for help
Jason Frey
@Fryguy
May 10 2016 15:33
np
if you have a gist...would still like to see
Keenan Brock
@kbrock
May 10 2016 15:37
will do