Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow to synthesize CloudFrontToS3 pattern with other patterns #229

Open
beomseoklee opened this issue Jun 22, 2021 · 2 comments
Open

Slow to synthesize CloudFrontToS3 pattern with other patterns #229

beomseoklee opened this issue Jun 22, 2021 · 2 comments
Assignees
Labels
Backlog We don't have the bandwidth to support this task right now, but will consider it in the future. bug Something isn't working question Further information is requested Researching We're looking deeper into this issue to see what's involved.

Comments

@beomseoklee
Copy link
Contributor

I'm using several patterns, and one of them, CloudFrontToS3 pattern is really slow to create a CloudFormation template when I run cdk synth. I put the simple console.time and console.timeEnd to see how long it takes, and I found the below one caused the most time:

export function overrideProps(DefaultProps: object, userProps: object, concatArray: boolean = false): any {
// Notify the user via console output if defaults are overridden
const overrideWarningsEnabled = (process.env.overrideWarningsEnabled !== 'false');
if (overrideWarningsEnabled) {
flagOverriddenDefaults(DefaultProps, userProps);
}

Reproduction Steps

The below one is the source code from my project (part of the source code):

    console.time('CloudFrontToS3')
    const cloudFrontToS3 = new CloudFrontToS3(this, 'CloudFrontToS3', {
      bucketProps: {
        serverAccessLogsBucket: props.s3LoggingBucket,
        serverAccessLogsPrefix: 's3/'
      },
      cloudFrontDistributionProps: {
        enableLogging: true,
        logBucket: props.s3LoggingBucket,
        logFilePrefix: 'cf/'
      },
      insertHttpSecurityHeaders: false
    });
    console.time('CloudFrontToS3')

Environment

  • CDK CLI Version : 1.107.0
  • CDK Framework Version: 1.107.0
  • AWS Solutions Constructs Version : 1.107.0
  • OS : macOS Catalina Version 10.15.7
  • Language : TypeScript

Other

This is the time that I measured for different patterns used at the same time:

overrideProps: 0.107ms
KinesisStreamsToKinesisFirehoseToS3: 24.668ms
overrideProps: 0.149ms
overrideProps: 0.084ms
SqsToLambda: 16.71ms
overrideProps: 0.358ms
LambdaToDynamoDB: 8.115ms
overrideProps: 0.139ms
overrideProps: 0.293ms
LambdaToDynamoDB: 4.523ms
overrideProps: 0.089ms
**overrideProps: 6:34.080 (m:ss.mmm)**
(node:36831) Warning: Label 'deepdiff' already exists for console.time()
(node:36831) Warning: Label 'deepdiff' already exists for console.time()
(node:36831) Warning: Label 'deepdiff' already exists for console.time()
(node:36831) Warning: Label 'deepdiff' already exists for console.time()
(node:36831) Warning: Label 'deepdiff' already exists for console.time()
(node:36831) Warning: Label 'CloudFrontToS3' already exists for console.time()

And I don't know what caused the above warning (haven't investigated deeply), but it seems like somewhere, it's looping for the below source code because I only put the time measurement for CloudFrontToS3 once.

function findOverrides(defaultProps: object, userProps: object) {
const diff = deepdiff.diff(defaultProps, userProps, _prefilter);

If you need more information, please let me know.


This is 🐛 Bug Report

@beomseoklee beomseoklee added bug Something isn't working needs-triage The issue or PR still needs to be triaged labels Jun 22, 2021
@biffgaut biffgaut self-assigned this Jul 6, 2021
@biffgaut biffgaut added Researching We're looking deeper into this issue to see what's involved. and removed needs-triage The issue or PR still needs to be triaged labels Jul 8, 2021
@biffgaut
Copy link
Contributor

As we discussed privately, I ran this code and did not see the behavior you report and you were going to look deeper to see how to reproduce this. In the meantime I'll put it on our backlog.

@biffgaut biffgaut added Backlog We don't have the bandwidth to support this task right now, but will consider it in the future. question Further information is requested labels Jul 19, 2021
@thebergamo
Copy link

I step into this issue while writing my tests using it. It seems that when you provides existingBucket or bucketProps it goes slow and no combination can help with that.

If there is any direction pointed here I would love to contribute with some fix for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog We don't have the bandwidth to support this task right now, but will consider it in the future. bug Something isn't working question Further information is requested Researching We're looking deeper into this issue to see what's involved.
Projects
None yet
Development

No branches or pull requests

3 participants