Skip to content

(hotswap, watch): skip synthesis if the change is only to an Asset #884

@skinny85

Description

@skinny85

Description

There is a possible performance optimization with cdk watch: if a given change event is for a file that belongs to an Asset, we can skip synthesizing the Cloud Assembly again (we know it will be the same).

Since synthesis is actually the bottleneck for many hotswap deployments (like for Lambda, or for StepFunctions), this might be a significant performance improvement for some use cases, especially in non-NodeJS languages.

Use Case

Hotswapping of resources where cdk synthesis is the performance bottleneck, especially in non-NodeJS languages.

Proposed Solution

The implementation of this would be quite complex. Basically, when we receive a change in cdk watch, we have to:

  1. Check that it belongs to the files/directories of any Asset in any of the Stack(s) we are deploying with watch.
  2. For each of those found Assets, we now have to search the template of the Stack(s) to determine which resources reference that Asset.
  3. For each of those resources, we now have to send them to the hotswap detectors to verify whether they support hotswapping.
  4. If all of them do, we can now perform hotswapping without running cdk synth before.

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions