Skip to content

Delay Schema Caching Until Resource Operations #784

@bflad

Description

@bflad

Module version

v1.3.1

Description

Currently, this Go module will cache data source and managed resource (collectively called "resource" from now on) schemas when the GetProviderSchema RPC is called. This caching was introduced to prevent the multiple RPCs associated with a single resource from continually invoking the Schema method for no benefit as by Terraform's definition, schemas must be static. For large providers, this is very problematic as it will actively keep unused schema information that is likely not needed again in memory. Providers do not have an opt-out for this framework behavior.

Proposal

Rather than caching resource schemas during GetProviderSchema RPC, which in turn will keep all schemas in memory, only perform the caching when another resource-based operation RPC occurs. This should ensure that:

  • Go garbage collection can occur after the GetProviderSchema RPC
  • Actively used schemas still receive the slight performance benefit of caching rather than repeatedly invoking the Schema method

It'll be worth exploring with upstream if the schema fetching can be split across RPCs to prevent a large allocation for GetProviderSchema RPC response.

References

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions