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

[BUG] CLI installation takes a lot of time #1387

Open
2 tasks done
Amzani opened this issue Apr 24, 2024 · 6 comments
Open
2 tasks done

[BUG] CLI installation takes a lot of time #1387

Amzani opened this issue Apr 24, 2024 · 6 comments
Labels
bug Something isn't working stale

Comments

@Amzani
Copy link
Collaborator

Amzani commented Apr 24, 2024

Describe the bug.

Some users reports that CLI installation takes a lot of time:
https://asyncapi.slack.com/archives/C34F2JV0U/p1713883101267059

We need to investigate

Expected behavior

Installation time < 30s

Screenshots

https://asyncapi.slack.com/archives/C34F2JV0U/p1713883101267059

How to Reproduce

TBD

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

No, someone else can work on it

@Amzani Amzani added the bug Something isn't working label Apr 24, 2024
@Amzani
Copy link
Collaborator Author

Amzani commented Apr 24, 2024

Using npm

First time it took 114.91s

npm install -g @asyncapi/cli --cache /tmp/cli  | gnomon
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @hyperjump/[email protected]: This package was rolled into @hyperjump/json-schema as of v1.0.0
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm notice
npm notice New major version of npm available! 9.5.0 -> 10.5.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.2
npm notice Run npm install -g [email protected] to update!
npm notice
 114.9078s
   0.0001s   changed 1565 packages in 2m
   0.0000s
   0.0000s   149 packages are looking for funding
   0.0100s     run `npm fund` for details
   0.0001s

     Total   114.9182s

Second time, using the same cache it took 13.5s

npm install -g @asyncapi/cli --cache /tmp/cli  | gnomon
npm WARN deprecated [email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hyperjump/[email protected]: This package was rolled into @hyperjump/json-schema as of v1.0.0
  13.5474s
   0.0001s   changed 1565 packages in 13s
   0.0000s
   0.0000s   149 packages are looking for funding
   0.0141s     run `npm fund` for details
   0.0002s

     Total   13.5620s

@peter-rr
Copy link
Member

Using brew

First time, it took 52.64s :

brew install asyncapi  
==> Downloading https://ghcr.io/v2/homebrew/core/asyncapi/manifests/1.9.0
############################################################################################################################################################## 100.0%
==> Fetching asyncapi
==> Downloading https://ghcr.io/v2/homebrew/core/asyncapi/blobs/sha256:53a01d02e9e4c9942ebe9e2cfc857a8f7c7840497391c02e2ddde07bce4d17fe
############################################################################################################################################################## 100.0%
==> Pouring asyncapi--1.9.0.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/asyncapi/1.9.0: 43,491 files, 521MB
==> Running `brew cleanup asyncapi`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Second time, it took 45.65s with reinstallation:

 brew reinstall asyncapi
==> Downloading https://ghcr.io/v2/homebrew/core/asyncapi/manifests/1.9.0
Already downloaded: /Users/pedro.ramos/Library/Caches/Homebrew/downloads/af369171fda6c5f2a91f8eb08c2fa1f9b460ca6249e094d83e190d10fdf5cac2--asyncapi-1.9.0.bottle_manifest.json
==> Fetching asyncapi
==> Downloading https://ghcr.io/v2/homebrew/core/asyncapi/blobs/sha256:53a01d02e9e4c9942ebe9e2cfc857a8f7c7840497391c02e2ddde07bce4d17fe
Already downloaded: /Users/pedro.ramos/Library/Caches/Homebrew/downloads/e51d9fa11b5a9496ed1451d9417d0c9502fcfdeb51c521f2299e42c9dfb35d42--asyncapi--1.9.0.arm64_sonoma.bottle.tar.gz
==> Reinstalling asyncapi 
==> Pouring asyncapi--1.9.0.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/asyncapi/1.9.0: 43,491 files, 521MB
==> Running `brew cleanup asyncapi`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Gonna try with npm as well.

@peter-rr
Copy link
Member

Using npm

First time, it took 78.46s:

npm install -g @asyncapi/cli | gnomon
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hyperjump/[email protected]: This package was rolled into @hyperjump/json-schema as of v1.0.0
  78.4445s   
   0.0002s   added 1553 packages, and changed 1 package in 1m
   0.0000s   
   0.0000s   148 packages are looking for funding
   0.0228s     run `npm fund` for details
   0.0001s   
             
     Total   78.4680s

Second time, it took 13.9s using the same cache:

npm install -g @asyncapi/cli | gnomon
npm WARN deprecated [email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated @oclif/[email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hyperjump/[email protected]: This package was rolled into @hyperjump/json-schema as of v1.0.0
  13.9764s   
   0.0002s   changed 1554 packages in 14s
   0.0000s   
   0.0000s   148 packages are looking for funding
   0.0149s     run `npm fund` for details
   0.0001s   
             
     Total   13.9920s

@Amzani
Copy link
Collaborator Author

Amzani commented May 9, 2024

CLI have 41 production dependencies, by investigating the size:

┌──────────────────────────────────┬────────────┬─────────┐
│ name                             │ children   │ size    │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/generator              │ 0          │ 65.34M  │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/studio                 │ 0          │ 46.71M  │
├──────────────────────────────────┼────────────┼─────────┤
│ oclif                            │ 0          │ 10.28M  │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/modelina               │ 0          │ 5.12M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/parser                 │ 0          │ 3.45M   │
├──────────────────────────────────┼────────────┼─────────┤
│ ajv                              │ 0          │ 0.98M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @oclif/core                      │ 0          │ 0.86M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @oclif/plugin-not-found          │ 0          │ 0.79M   │
├──────────────────────────────────┼────────────┼─────────┤
│ request                          │ 0          │ 0.58M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/converter              │ 0          │ 0.47M   │
├──────────────────────────────────┼────────────┼─────────┤
│ node-fetch                       │ 0          │ 0.47M   │
├──────────────────────────────────┼────────────┼─────────┤
│ js-yaml                          │ 0          │ 0.39M   │
├──────────────────────────────────┼────────────┼─────────┤
│ reflect-metadata                 │ 0          │ 0.28M   │
├──────────────────────────────────┼────────────┼─────────┤
│ serve-handler                    │ 0          │ 0.28M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @oclif/errors                    │ 0          │ 0.17M   │
├──────────────────────────────────┼────────────┼─────────┤
│ fsevents                         │ 0          │ 0.17M   │
├──────────────────────────────────┼────────────┼─────────┤
│ unzipper                         │ 0          │ 0.15M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/protobuf-schema-parser │ 0          │ 0.14M   │
├──────────────────────────────────┼────────────┼─────────┤
│ ws                               │ 0          │ 0.13M   │
├──────────────────────────────────┼────────────┼─────────┤
│ uuid                             │ 0          │ 0.12M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/diff                   │ 0          │ 0.11M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @stoplight/spectral-cli          │ 0          │ 0.11M   │
├──────────────────────────────────┼────────────┼─────────┤
│ inquirer                         │ 0          │ 0.09M   │
├──────────────────────────────────┼────────────┼─────────┤
│ chokidar                         │ 0          │ 0.09M   │
├──────────────────────────────────┼────────────┼─────────┤
│ wrap-ansi                        │ 0          │ 0.07M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/optimizer              │ 0          │ 0.07M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/bundler                │ 0          │ 0.06M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/avro-schema-parser     │ 0          │ 0.06M   │
├──────────────────────────────────┼────────────┼─────────┤
│ fs-extra                         │ 0          │ 0.05M   │
├──────────────────────────────────┼────────────┼─────────┤
│ lodash.template                  │ 0          │ 0.05M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/openapi-schema-parser  │ 0          │ 0.05M   │
├──────────────────────────────────┼────────────┼─────────┤
│ open                             │ 0          │ 0.04M   │
├──────────────────────────────────┼────────────┼─────────┤
│ chalk                            │ 0          │ 0.04M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @clack/prompts                   │ 0          │ 0.04M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @smoya/asyncapi-adoption-metrics │ 0          │ 0.03M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @smoya/multi-parser              │ 0          │ 0.02M   │
├──────────────────────────────────┼────────────┼─────────┤
│ @asyncapi/raml-dt-schema-parser  │ 0          │ 0.02M   │
├──────────────────────────────────┼────────────┼─────────┤
│ fast-levenshtein                 │ 0          │ 0.01M   │
├──────────────────────────────────┼────────────┼─────────┤
│ picocolors                       │ 0          │ 0.00M   │
├──────────────────────────────────┼────────────┼─────────┤
│ indent-string                    │ 0          │ 0.00M   │
├──────────────────────────────────┼────────────┼─────────┤
│ strip-ansi                       │ 0          │ 0.00M   │
├──────────────────────────────────┼────────────┼─────────┤
│ 41 modules                       │ 0 children │ 137.89M │
└──────────────────────────────────┴────────────┴─────────┘

I think there is a way to improve this:

  1. Using https://github.com/tj/node-prune, we might decrease the size by 25 to 30%
  2. Remove local studio dependency: We can use the studio production version or invite the user to install additional plugins (Heroku for instance is doing that
  3. Investigate why @asyncapi/generator is too big

@peter-rr
Copy link
Member

We could start small and give it a try 👍 That should reduce the CLI installation time significantly.

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
Status: Backlog
Development

No branches or pull requests

2 participants