Cache r/o API requests to OS components during constraint validation

Registered by Kairat Kushaev

The basic use case that we need to improve is the following:
1. User prepares a template with N stacks that use the same resource (image, flavor, keypair, etc)
2. User requests Heat to create the stack
3. During custom constraint validation for every resource Heat does the following:
 - Find appropriate class that validates custom constraint
 - Request the other clients about constraint (check that the volume, server, flavor, etc exists)
 - If request was successful then pass validation.
This approach leads to some overhead because we need to request the same info several times. In addition, current realization doubles this overhead because we are checking constraints twice (for resource validation and stack validation).

So the desired use case is the following:
1. User prepares a template with N stacks that use the same resource (image, flavor, keypair, etc)
2. User requests Heat to create the stack
3. During custom constraint validation for every resource Heat does the following:
 - Find appropriate class that validates custom constraint
 - Request client plugin about validation data
 - Check client plugin cache and try to find result of API request with the same resource name (volume name, server, flavor, etc)
 - If no results is in cache then request other clients about volume, server, flavor and store the result in cache
 - Pass validation if no exceptions were raised

Perhaps there are some additional conditions that I need to consider. So I am looking forward for your feedback.

Blueprint information

Status:
Complete
Approver:
Angus Salkeld
Priority:
Medium
Drafter:
Kairat Kushaev
Direction:
Needs approval
Assignee:
Kairat Kushaev
Definition:
Approved
Series goal:
Accepted for liberty
Implementation:
Implemented
Milestone target:
milestone icon 5.0.0
Started by
Kairat Kushaev
Completed by
Kairat Kushaev

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/constraint-validation-cache,n,z

Addressed by: https://review.openstack.org/166810
    Improve constraint validation performance

Gerrit topic: https://review.openstack.org/#q,topic:add_dogpile_cache,n,z

Addressed by: https://review.openstack.org/185999
    Add dogpile cache core and turn on caching

Addressed by: https://review.openstack.org/195069
    [WIP!!] Enable caching for validation constraints

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.