Thursday, 2019-08-08

*** tetsuro has joined #openstack-placement01:40
openstackgerritEric Fried proposed openstack/placement master: Move provider_ids_from_rp_ids to allocation_candidate  https://review.opendev.org/67508402:54
*** tetsuro has quit IRC03:25
openstackgerritMerged openstack/placement master: Optimize trait creation to check existence first  https://review.opendev.org/67355503:47
*** tetsuro has joined #openstack-placement04:07
*** tetsuro has quit IRC06:32
*** tetsuro has joined #openstack-placement07:14
*** tetsuro has quit IRC07:18
*** tssurya has joined #openstack-placement07:23
*** takashin has left #openstack-placement08:01
openstackgerritChris Dent proposed openstack/placement master: Move provider_ids_from_rp_ids to allocation_candidate  https://review.opendev.org/67508408:14
*** tetsuro has joined #openstack-placement08:17
*** helenafm has joined #openstack-placement08:24
*** e0ne has joined #openstack-placement09:04
*** cdent has joined #openstack-placement09:07
openstackgerritChris Dent proposed openstack/placement master: Move provider_ids_from_rp_ids to allocation_candidate and fix  https://review.opendev.org/67508409:29
cdenttetsuro: fixed ^. thanks for catching that09:29
cdenttetsuro: this is another of the important perf fixes: https://review.opendev.org/#/c/673991/09:30
cdentand this is simply more data: https://review.opendev.org/#/c/673540/09:31
tetsuroThanks, will have a look on them09:32
cdentthank you09:32
cdentonce the first two are merged I'll compare profiles from the patch that added same_subtree to now. I'm hoping it will look pretty good09:33
openstackgerritChris Dent proposed openstack/placement master: Use another expanding bindparam in _get_usages_by_provider_trees  https://review.opendev.org/67528710:30
cdenttetsuro, gibi, stephenfin : Do any of you have strong feelings about using (or not) a different JSON dumper: https://review.opendev.org/674661 ?10:32
*** tetsuro has quit IRC11:02
cdentefried: when you have a spare momen to drag your mind back through history can you look at then you added this: https://review.opendev.org/#/c/517757/31..33/nova/api/openstack/placement/objects/resource_provider.py,unified and recall the reasons why? It's not a not-deep copy, but it is _expensive_. If I change it to not copy, we don't get accurate results, but I'm struggling to suss out the exact mechanisms of why11:12
gibicdent: left comments in https://review.opendev.org/#/c/674661 I'm not against a different json lib if we make a well informed decision11:37
cdentthanks gibi11:38
openstackgerritChris Dent proposed openstack/placement master: Correct SQL docstring on _get_usages_by_provider_trees  https://review.opendev.org/67530211:43
*** tssurya has quit IRC11:50
*** tssurya has joined #openstack-placement11:50
*** cdent has quit IRC12:04
*** takashin has joined #openstack-placement12:19
openstackgerritMerged openstack/placement master: _get_all_by_filters_from_db do not cast to list of dict  https://review.opendev.org/67399113:02
*** cdent has joined #openstack-placement13:05
*** mriedem has joined #openstack-placement13:16
efriedcdent: It was so we don't reuse arrZ across separate results13:17
cdentefried: I understand that, but where are we post-manipulating the ones that we've already used?13:18
efriedI don't have it fully in my head, but something about the way we blow out that itertools.product means we would have otherwise ended up trying to use the same arr for a different result. And the algorithm there is changing its values, so they'd be wrong for the other result.13:18
efried(itertools.product in _merge_candidates that is)13:19
openstackgerritMerged openstack/placement master: Add apache benchmark (ab) to end of perfload jobs  https://review.opendev.org/67354013:19
cdentso, at the mo, _merge_candidates and especially _consolidate... are big hitters in the proflle data and they happen to be the parts I least understand13:20
efriedI remember debugging this and putting a printf in that spot. Maybe like printing the __id__ of the arr? And proving that we're hitting the same one more than once13:20
efriedYeah, that's not surprising. _merge_candidates is a beast.13:20
* cdent nods13:20
cdentit isn't, however, as much of an issue as the json dumping13:21
efrieddoes that copy stand out as being the most expensive part of _merge_candidates?13:21
cdentyes13:22
cdentit's the most expensive part of _consolidate, which is the most expensive part of _merge13:22
efriedI assume it would make no difference if instead of copy you explicitly initialized a new ARR at that point13:23
cdentI wouldn't have thought so, unless copy is doing something really weird. It may be worth trying, but I haven't, yet13:24
efriedwe're probably only noticing because here we're rebuilding *all* the ARRs at once, whereas otherwise we're building them spread out13:24
efriedlike, building them the first time is probably just as expensive, but spread out, am I making sense?13:24
cdentthe profile is aggregating the total time of a method across all n-thousand times it is called during one request13:25
cdent(at a particular location in the call tree)13:25
efriedSo I'm saying, if you look at ARR's constructor, does it overall account for 2x the time of that copy?13:27
cdentlet me find some data13:28
efriedAnyway, not sure that's a super productive line of inquiry. Point is that we most likely don't need that copy a large percentage of the time.13:29
cdent(it's hard to find the data because of the way filenames are truncated...)13:30
cdentnote: 60060.0015912.649e-070.0015912.649e-07allocation_candidate.py:217(__init__)13:31
cdent0.0797 for the copy13:32
cdent20020.023761.187e-050.10895.44e-05allocation_candidate.py:598(_consolidate_allocation_requests)13:32
efriedI think it becomes necessary when we have multiple permutations of results involving the same tree, when you've requested the same resource class from multiple groups. Let me try to concoct an example...13:33
efried...and also only with group_policy=none13:34
efriedso like, if you ask for VF:1,VF:1 and your host has multiple PFs13:34
*** stephenfin has quit IRC13:35
efriedYou'll get a results with13:35
efried PF1{VF:1},PF2{VF:1}13:35
efried PF1{VF:2}13:35
efried PF2{VF:2}13:35
efriedTo get those four results, we start with only two ARRs: PF1{VF:1} and PF2{VF:1}13:36
efrieds/four/three/13:36
*** stephenfin has joined #openstack-placement13:36
efriedwhen we construct the second result, in _consolidate if we just used the original PF1{VF:1} and incremented it, it would make the first result wrong.13:37
efriedSo we have to copy the ARR13:37
efriedis this making sense?13:37
* cdent nods13:39
efriedso what we could conceivably do, assuming we don't just find that copy() is borked, is do some calculations ahead of time to figure out whether the copy is necessary13:39
efriedLike, if group_policy=isolate it should never be necessary.13:40
efriedAnd if this RC only shows up in one request group, it shouldn't be necessary for this RC.13:40
efriedand then extend this conditional with a third branch that just assigns, doesn't copy, in those cases.13:40
cdentI'm hesitant to make changes that need to be overly aware of the requesting style13:41
efriedactually, it's possible we should never be hitting _consolidate at all with group_policy=isolate13:41
cdentimma try a thing, hold please13:41
efriedyeah, I agree with you, but that's how perf tuning goes.13:41
efriedclean, slow code => messy, performant code13:41
cdentyes, I know, but I don't think we're there yet13:44
cdentwe currently have messy slow that is being improved to less messy and faster13:44
cdentinteresting13:45
cdentimplement our own __copy__ seems to help quite a bit:13:46
cdent0.0797 -> 0.022513:46
cdentand what that copy is is simply create a new object with same attributes13:46
efriedthat sounds like a python bug13:46
efriedfwiw, passing group_policy in and blowing out that conditional to only copy for 'none' passes func tests13:47
cdentit's standard python: if you don't like what copy does natively, add a __copy__13:47
cdentI'm just surprised in this case that it makes so much difference13:47
cdentup front python can't look at an object and know that a simple clone is sufficient because of the way attributes are managed13:47
cdentbut yeah, it does seem dumb13:47
* cdent makes yet another patch13:47
efriedI want to say I tried this a couple different ways while I was messing with this.13:48
efriedOne of them was, instead of implementing __copy__, I just initialized a new object explicitly using the fields of the old one. Basically inlining the __copy__logic.13:48
efriedbut yeah, __copy__ is better13:49
efriedany interest in doing the group_policy-based thing?13:49
cdentit's apparently the "idiomatic" form of "clone()"13:49
cdentmaybe later13:49
cdentI want to avoid that sort of thing until we absolutely run out of others things13:49
efriedokay. FWIW it's just this http://paste.openstack.org/show/755656/ (pep8 would need fixing)13:50
cdentand doing __copy__ more than halves the cost of _consolidate13:50
cdentyou could go ahead and put that in gerrit and we could decide by looking at the numbers13:51
cdenti don't know if we are doing much isolate-driven testing yet, though?13:51
cdentnot in perfload13:51
efrieddunno. And that'll become N/A hopefully soon when we stop using big-hammer group_policy13:52
cdentis that Y or Z at this point?13:53
efriedI can work up the other optimization as well, where we only do the copy for resources we requested multiples of from separate groups.13:53
* cdent scurries away13:53
cdentthere's another copy that ought to be helped by the same thing (for AR instead of ARR)14:00
*** cdent has quit IRC14:31
*** takashin has left #openstack-placement15:00
openstackgerritChris Dent proposed openstack/placement master: Add __copy__ method to AllocationRequest{,Resource}  https://review.opendev.org/67537215:02
*** tssurya has quit IRC15:43
*** helenafm has quit IRC15:45
*** e0ne has quit IRC16:16
*** cdent has joined #openstack-placement16:29
*** Sundar has joined #openstack-placement16:51
*** Sundar has quit IRC16:54
*** e0ne has joined #openstack-placement17:05
openstackgerritChris Dent proposed openstack/placement master: Add __copy__ method to AllocationRequest{,Resource}  https://review.opendev.org/67537217:08
cdentheh, a single response to the nested-perfload GET /a_c query, when sent through json_pp is 154006 lines17:09
cdenti now feel slightly less bad about it taking more than a second17:10
openstackgerritEric Fried proposed openstack/placement master: Copy AllocationRequestResource only when necessary  https://review.opendev.org/67541617:12
efriedcdent: Wanna do your profiley thing on ^ ?17:13
efriedIt's a tad hacky, but not as bad as it could be really.17:13
cdentbecause _consolidate is called multiple times and your closing over rw_ctx, that method would be better defined out side of _consolidate... and have rw_ctx passed to it17:16
cdenti think17:16
efriedI had that and moved it because it's so specific to that method17:17
efriedbut don't I *want* to close over rw_ctx, which doesn't change throughout a request?17:17
efriedfor that matter, make it a method on rw_ctx?17:17
efriedI mean, this works correctly test-wise, are you saying it might perform better if refactored a certain way?17:17
cdenta method on rw_ctx would be okay too, but the issue is that python has to recompute the definition of _copy_arr_if_needed each time _consolidate_allocation_requests is called17:18
efriedokay.17:18
cdent(otherwise it seems like a great idea and I'm happy to go profiley on it, but I'm in the midst of writing up a bunch of profiley stuff, so my profiling tooling is in use)17:19
openstackgerritEric Fried proposed openstack/placement master: Copy AllocationRequestResource only when necessary  https://review.opendev.org/67541617:24
efriedcdent: moved ^17:24
efriedactually makes a fair bit of sense in there17:24
* cdent loosk again17:31
cdentrequest wide context was a good add17:32
cdenti suspect eventually all sort of crap will be hanging from it17:32
*** e0ne has quit IRC17:35
cdentefried: it definitely seems to help, at least for the case that nested-perfload is presenting17:39
efriedcool. Be interesting to see how much it helps, esp. if it still helps on top of your __copy__ fix17:40
cdentyeah. It's hard to make solid comparisons with the changes all coming in in parallel17:41
cdentwith your change, _consolidate is no longer the big consumer under _merge, _satisfies_same_subtree is17:42
efriedcdent: I suspect that "same RC in multiple groups" will be relatively rare, until we have NUMA modeling. And most NUMA modeling will want to isolate (I think??) so it'll still help there. And even for cases where we do need the copy, it'll *only* be for the ARRs whose RCs were requested in more than one group, which will (probably, almost) never be all of them.17:42
cdentwhat is make _satisfies_same_subtree hot is _get_ancestors_by_one_uuid17:42
efriedso basically, I think this optimization makes us very rarely copy17:42
* cdent nods17:42
efriedthat's not surprising. Recursive sucks.17:43
cdentfunctional tests screaming along nicely: 1027 tests in 8.6472 sec17:48
cdenthttps://anticdent.org/placement-performance-analysis.html17:50
cdentby morning I'm hoping the gate will have caught up with me and I'll redo the analysis17:53
cdentbut now17:53
* cdent waves17:53
*** cdent has quit IRC17:53
openstackgerritMerged openstack/placement master: Move provider_ids_from_rp_ids to allocation_candidate and fix  https://review.opendev.org/67508418:59
openstackgerritMerged openstack/placement master: Use another expanding bindparam in _get_usages_by_provider_trees  https://review.opendev.org/67528718:59
*** e0ne has joined #openstack-placement19:16
*** e0ne has quit IRC20:37
openstackgerritChris Dent proposed openstack/placement master: Add __copy__ method to AllocationRequest{,Resource}  https://review.opendev.org/67537221:34
*** takashin has joined #openstack-placement21:48

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!