The current implementation of stack_count_total_resources
scales very poorly for stacks with many nested stacks.
This change replaces the implementation with a single count
query filtering on the resource.root_stack_id column.
The following template was used for performance testing:
heat_template_version: 2015-04-30
description: >
Stress test, create many stacks in a RG
parameters:
count:
type: number
default: 4
resources:
dummies:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: count}
resource_def:
type: dummy_node.yaml
# dummy_node.yaml
heat_template_version: 2015-04-30
parameters:
resources:
random:
type: OS::Heat::RandomString
randoms:
type: OS::Heat::ResourceGroup
properties:
count: 1
resource_def:
type: OS::Heat::RandomString
This template was used to time the stack creation with
count=40 and count=80 against heat-master, the previous
change I2b00285514235834131222012408d2b5b2b37d30
and this change. Here are the results:
Stack heat-master-40 CREATE_COMPLETE
real 1m9.103s
Stack root-stack-id-40 CREATE_COMPLETE
real 0m59.233s
Stack count-total-resources-40 CREATE_COMPLETE
real 0m43.308s
Stack heat-master-80 CREATE_COMPLETE
real 2m47.190s
Stack root-stack-id-80 CREATE_COMPLETE
real 2m16.743s
Stack count-total-resources-80 CREATE_COMPLETE
real 1m15.288s
Also, the test template in bug #1489548 took 3 minutes
to create (vs the originally reported 13 minutes).
Change-Id: Iab3eaaba3ece16e14db3231f1c725bca3c8985c2
Closes-Bug: 1489548