aws / aws/aws-cdk-cli

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

Open
#884 2 comments 12 reactions 0 assignees View on GitHub
effort/large feature-request p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### 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

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.