Resolving stack outputs can be expensive
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Fix Released
|
High
|
Zane Bitter |
Bug Description
When stack is shown (via show_stack) or loaded as nested stack, its outputs are re-resolved. When the outputs of a top-level stack reference a nested stack's outputs that in turn reference another nested stack (and so on), the calculation of the outputs can become quite expensive in terms of memory usage (loading a lot of nested stacks) and time.
Ideally, some (or all) of a stack's outputs or resource attributes would be stored to avoid the full expense of re-resolving them whenever they are referenced again.
Changed in heat: | |
assignee: | nobody → Crag Wolfe (cwolfe) |
status: | New → In Progress |
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master) | #1 |
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master) | #2 |
Fix proposed to branch: master
Review: https:/
Crag Wolfe (cwolfe) wrote : | #3 |
With patch set 2 in https:/
OpenStack Infra (hudson-openstack) wrote : | #4 |
Fix proposed to branch: master
Review: https:/
Changed in heat: | |
assignee: | Crag Wolfe (cwolfe) → Zane Bitter (zaneb) |
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master) | #5 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #6 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 10a75d87dd171cb
Author: Zane Bitter <email address hidden>
Date: Thu Jun 8 21:48:17 2017 -0400
Always return live resource attributes in list_stack_
Currently, we do live resolution of attribute values when in
list_
in the database those values that are referenced elsewhere in the template.
Since it's unlikely that every attribute would be referenced in the
template, this could lead to the API returning an inconsistent mix of live
and cached data.
Caching all of the attribute values on the off chance that someone might
request them through this obscure API would be expensive, and there are
also users that need to be able to access live resource attributes via
Heat. Therefore, always return live data for the resource attributes in
this API.
Change-Id: Ifea71b30299076
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master) | #7 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master) | #8 |
Fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #9 |
Fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #10 |
Fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master) | #11 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #12 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master) | #13 |
Change abandoned by Zane Bitter (<email address hidden>) on branch: master
Review: https:/
Reason: I reworked I07ac22cc4370a7
OpenStack Infra (hudson-openstack) wrote : | #14 |
Change abandoned by Zane Bitter (<email address hidden>) on branch: master
Review: https:/
Reason: I reworked I07ac22cc4370a7
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #15 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit f47efe532d2e55f
Author: Zane Bitter <email address hidden>
Date: Wed Jun 21 20:04:01 2017 -0400
Never cache the 'show' attribute
The 'show' attribute is used to get all data about a resource. There are
folks using this in lieu of having access to the underlying OpenStack APIs
themselves. By not caching it, we ensure that they will always see a live
value, even once we start storing attribute values in the database when
modifying a resource.
Change-Id: Id81a56f7d774bc
Co-Authored-By: Crag Wolfe <email address hidden>
Related-Bug: #1660831
Changed in heat: | |
milestone: | none → pike-3 |
importance: | Undecided → High |
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master) | #16 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 0550659f5ffa9c8
Author: Crag Wolfe <email address hidden>
Date: Wed Jun 21 20:04:01 2017 -0400
Store resource attributes in the DB
Store resource attributes that may be cached in the DB, saving the
cost of re-resolving them later. This works for most resources,
specifically those that do not override the get_attribute() method.
Change-Id: I71f8aa431a6045
Partial-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : | #17 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 176c3f7d142ba40
Author: Zane Bitter <email address hidden>
Date: Wed Jun 21 20:04:01 2017 -0400
Mark Server os_collect_config attribute as CACHE_NONE
When the os_collect_config attribute was added to OS::Nova::Server (in
64ddd071604
_resolve_
former so it is never called (for this attribute) and so that the value is
never cached. To be sure, to be sure, the attribute caches - which cannot
contain the value of this attribute - were cleared whenever the deployment
data is updated.
It's much easier to just mark the attribute as CACHE_NONE. This also makes
the status of this attribute visible to other parts of the code.
Change-Id: Icaecf70529f19f
Partial-Bug: #1660831
Partially-
OpenStack Infra (hudson-openstack) wrote : | #18 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 45e4c53f78a2211
Author: Zane Bitter <email address hidden>
Date: Wed Jun 21 20:04:01 2017 -0400
Cache attributes with custom handling
Previously, all caching of attribute values was done via the Attributes
object. However, some resource types override Resource.
do custom handling of the trailing attribute path or dynamic attribute
names, and in these cases the resulting values were not cached (since they
don't go through the Attributes object).
This patch adds a caching step for these resources:
* OS::Senlin::Cluster
* OS::Heat:
* OS::Heat:
* OS::Heat:
* OS::Heat:
* OS::Heat:
* TemplateResource
* AWS::CloudForma
Change-Id: I07ac22cc4370a7
Co-Authored-By: Crag Wolfe <email address hidden>
Partial-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master) | #19 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #20 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master) | #21 |
Change abandoned by Zane Bitter (<email address hidden>) on branch: master
Review: https:/
Reason: Will merge I50de08ae6b4095
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #22 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 4250958a0384e2b
Author: Zane Bitter <email address hidden>
Date: Thu Jun 29 09:07:02 2017 -0400
Add an add_output() method to Template
This helps with dynamically building templates, and is similar to the
add_resource method.
Change-Id: I51ce5c91343808
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : | #23 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit f256b61dd222f64
Author: Zane Bitter <email address hidden>
Date: Thu Jun 29 09:07:02 2017 -0400
Refactor out a new Resource.
Calculating all of the attributes of a resource that are referenced in the
template was previously done inside the node_data() method, but this is
useful for the resource to be able to access for other reasons so refactor
it into a separate method.
Change-Id: I8ec943652e6f93
Related-Bug: #1660831
Partially-
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master) | #24 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 1fff9516398e40f
Author: Zane Bitter <email address hidden>
Date: Mon Jul 10 13:47:59 2017 -0400
Create explicit outputs in StackResources
When we are accessing attributes of resources in a nested stack (via
attributes of the parent resource), create output definitions in the nested
template to explicitly reference them.
In the long term, this should enable us to access the attribute values as
outputs directly using the APIs, rather than querying the resources
individually.
In the short term though, this means that access to these resource
attributes is no longer invisible to the child stack, so it will be able to
store the values of the attributes that are accessed (and ignore the ones
that are not).
Change-Id: I61d8e5deff45a6
Partial-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #25 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit b902d93ade7f22e
Author: Zane Bitter <email address hidden>
Date: Mon Jul 10 13:48:01 2017 -0400
Handle errors calculating dep_attrs for nested get_attr
Ensure that in convergence we can calculate the dep_attrs of a resource,
including the attributes referenced in outputs, even if:
- One of the resource's attributes is referenced in an ouput; and
- The attribute path itself also contains a get_attr function; and
- The attribute referenced by the inner get_attr function in the output is
not referenced by any resources.
Since the attributes referenced only in outputs (and not in resources) are
not passed to dependent resources in the NodeData, the data required to
resolve the inner get_attr function is not available. Therefore getting the
dep_attrs for the relevant resource from the output definition would fail.
The next patch does so during the calculation of the NodeData, and any
resulting exception is not caught (bug 1703043), so the stack would end up
stuck IN_PROGRESS.
To avoid this, ignore any errors resolving attribute path components in the
course of calculating the dep_attrs of a given resource. This may mean that
an attribute value required for the outputs is not stored in the database,
but it can still be resolved live later.
Change-Id: I2ed1e3dacd371e
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master) | #26 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit cfff39ce68be4ad
Author: Zane Bitter <email address hidden>
Date: Mon Jul 10 13:47:59 2017 -0400
Always cache attributes in outputs in Resource.
Ensure that attributes that are referenced in outputs get cached (and
therefore stored in the database) even when they are not referenced by
other resources.
Change-Id: I667ab04f91eddd
Closes-Bug: #1660831
Changed in heat: | |
status: | In Progress → Fix Released |
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 9.0.0.0b3 | #27 |
This issue was fixed in the openstack/heat 9.0.0.0b3 development milestone.
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #28 |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit 118fc127b3fcf29
Author: Zane Bitter <email address hidden>
Date: Tue Jun 13 19:38:21 2017 -0400
Fix a DB error when updating the resource attributes
This prevents the attributes from being stored sometimes, and is possibly
correlated with occasional random failures of the gate jobs.
Change-Id: I8f6567ec792bd0
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master) | #29 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #30 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #31 |
Related fix proposed to branch: master
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #32 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit 3ec13d9a8fe1ccf
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Fix attribute caching in SoftwareDeploym
When the parent template references the 'deploy_stdouts', 'deploy_stderrs',
or 'deploy_
SoftwareDep
the corresponding 'deploy_stdout', 'deploy_stderr', or 'deploy_
(all singular) attributes of the child template's SoftwareDeployment
resources.
Change-Id: Iff7101dbaa5760
Closes-Bug: #1741552
Partial-Bug: #1731349
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : | #33 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit 4a3a1ad15bdcfd6
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Fix attribute caching in Heat AutoScalingGroup
Attributes for an individual resource in an OS::Heat:
be retrieved using the attribute name 'resource.<index>'. Because we were
treating the index as a resource name when generating the template, we
would never generate an output in the nested template that referenced the
resource's attribute, so it wouldn't get cached. Since we can't know the
indices ahead of time, the only way to cache these is to do it for all
resources in the group - which is the same data cached by the equivalent
'outputs' attribute.
We also need to take into account both possible forms of syntax:
or:
Change-Id: I1d2898cdd4759b
Closes-Bug: #1737047
Partial-Bug: #1731349
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : | #34 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit 77112137bb36830
Author: Zane Bitter <email address hidden>
Date: Tue Jan 9 11:29:25 2018 -0500
Fix resource.<n> attribute caching in ResourceGroup/Chain
When generating the nested template output, we need to take into account
both forms of syntax:
get_attr: [<group_name>, resource.
or
get_attr: [<group_name>, resource.<index>, <attr_name>, ...]
Previously we would generate an output for the former case but not the
latter, so the attribute wouldn't get cached when that syntax was used.
Change-Id: I2a059d5cc42d79
Closes-Bug: #1742185
Partial-Bug: #1731349
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (stable/pike) | #35 |
Related fix proposed to branch: stable/pike
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #36 |
Related fix proposed to branch: stable/pike
Review: https:/
OpenStack Infra (hudson-openstack) wrote : | #37 |
Related fix proposed to branch: stable/pike
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master) | #38 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: master
commit 7a046e6ffd8daaa
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Include outputs in rolling update of ResourceGroup
The template generated by ResourceGroup should include outputs that
reference any needed resource attributes. However, previously it only did
so when rolling updates were not enabled by an update_policy.
Change-Id: Ice7a92fe8d2b14
Closes-Bug: #1741981
Partial-Bug: #1731349
Related-Bug: #1660831
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (stable/pike) | #39 |
Related fix proposed to branch: stable/pike
Review: https:/
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (stable/pike) | #40 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit cabb3b965c3358a
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Fix attribute caching in SoftwareDeploym
When the parent template references the 'deploy_stdouts', 'deploy_stderrs',
or 'deploy_
SoftwareDep
the corresponding 'deploy_stdout', 'deploy_stderr', or 'deploy_
(all singular) attributes of the child template's SoftwareDeployment
resources.
Change-Id: Iff7101dbaa5760
Closes-Bug: #1741552
Partial-Bug: #1731349
Related-Bug: #1660831
(cherry picked from commit 3ec13d9a8fe1ccf
tags: | added: in-stable-pike |
OpenStack Infra (hudson-openstack) wrote : | #41 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 07382d99d1b4dcf
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Fix attribute caching in Heat AutoScalingGroup
Attributes for an individual resource in an OS::Heat:
be retrieved using the attribute name 'resource.<index>'. Because we were
treating the index as a resource name when generating the template, we
would never generate an output in the nested template that referenced the
resource's attribute, so it wouldn't get cached. Since we can't know the
indices ahead of time, the only way to cache these is to do it for all
resources in the group - which is the same data cached by the equivalent
'outputs' attribute.
We also need to take into account both possible forms of syntax:
or:
Change-Id: I1d2898cdd4759b
Closes-Bug: #1737047
Partial-Bug: #1731349
Related-Bug: #1660831
(cherry picked from commit 4a3a1ad15bdcfd6
OpenStack Infra (hudson-openstack) wrote : | #42 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit e94e90b4f2f787c
Author: Zane Bitter <email address hidden>
Date: Tue Jan 9 11:29:25 2018 -0500
Fix resource.<n> attribute caching in ResourceGroup/Chain
When generating the nested template output, we need to take into account
both forms of syntax:
get_attr: [<group_name>, resource.
or
get_attr: [<group_name>, resource.<index>, <attr_name>, ...]
Previously we would generate an output for the former case but not the
latter, so the attribute wouldn't get cached when that syntax was used.
Change-Id: I2a059d5cc42d79
Closes-Bug: #1742185
Partial-Bug: #1731349
Related-Bug: #1660831
(cherry picked from commit 77112137bb36830
OpenStack Infra (hudson-openstack) wrote : | #43 |
Reviewed: https:/
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 1cb985536c6b208
Author: Zane Bitter <email address hidden>
Date: Mon Jan 8 17:23:12 2018 -0500
Include outputs in rolling update of ResourceGroup
The template generated by ResourceGroup should include outputs that
reference any needed resource attributes. However, previously it only did
so when rolling updates were not enabled by an update_policy.
The tests are trivially different than the patch on master, only because
ce120bfda84
Change-Id: Ice7a92fe8d2b14
Closes-Bug: #1741981
Partial-Bug: #1731349
Related-Bug: #1660831
(cherry picked from commit 7a046e6ffd8daaa
Reviewed: https:/ /review. openstack. org/422982 /git.openstack. org/cgit/ openstack/ heat/commit/ ?id=9ebbd1e6f11 40467041220f9f7 2d5e3c7fe03b2f
Committed: https:/
Submitter: Jenkins
Branch: master
commit 9ebbd1e6f114046 7041220f9f72d5e 3c7fe03b2f
Author: Crag Wolfe <email address hidden>
Date: Thu Jan 19 19:54:54 2017 -0500
Data migration enabling storage of resource attributes
Working towards the goal of storing resource attributes in the db so properties_ data table.
as to avoid re-resolving them when appropriate. Adds an 'attr_data'
object to the resource object, defined as a relationship on the
already existing resource_
Change-Id: I2104078d850da0 8b22547d7feab2b de00c543478
Partial-Bug: #1660831