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

"Unzipping Cypress" takes four minutes #3803

Closed
kevinburkenotion opened this issue Mar 22, 2019 · 21 comments · Fixed by #5851
Closed

"Unzipping Cypress" takes four minutes #3803

kevinburkenotion opened this issue Mar 22, 2019 · 21 comments · Fixed by #5851

Comments

@kevinburkenotion
Copy link

@kevinburkenotion kevinburkenotion commented Mar 22, 2019

I have a t2.xlarge instance in AWS. I am attempting to run npm install inside of a Docker container to install Cypress 3.1.5.

I noticed that 4 minutes elapse between the start of "Unzipping Cypress" and its completion.

[00:19:28]  Unzipping Cypress       [started]
[00:23:13]  Unzipping Cypress       [completed]

This seems like an awfully long time to spend unzipping a binary... any idea what is going on?

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Mar 22, 2019

@kevinburkenotion
Copy link
Author

@kevinburkenotion kevinburkenotion commented Mar 22, 2019

It's inside of a npm install step in a Docker container, so we either get the cached image or nothing, I think, unless you have better ideas.

@kevinburkenotion
Copy link
Author

@kevinburkenotion kevinburkenotion commented Mar 22, 2019

Any reason why you are not using gunzip or tar or similar to unpack the binary?

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Mar 22, 2019

@kevinburkenotion
Copy link
Author

@kevinburkenotion kevinburkenotion commented Mar 22, 2019

Understood, but 4 minute long unpacking on an AWS VM that's as powerful as a high end Macbook is not really great either.

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Mar 22, 2019

@cvuorinen
Copy link

@cvuorinen cvuorinen commented Aug 21, 2019

Even though it does not take 4 min on my machine, after adding cypress to a project it makes switching branches just painful to always wait few minutes for downloading & unzipping cypress. Can't you cache it somewhere like other npm packages? I mean when switching branches where just one dep has changed, run npm ci and before cypress it was just few seconds since (almost) everything comes from cache, since adding cypress it's a waiting game that I try to avoid. I mean I just downloaded & unzipped the thing few minutes ago, such a waste (of bandwidth, cpu and most importantly my time).

@flotwig
Copy link
Member

@flotwig flotwig commented Aug 21, 2019

@cvuorinen If you're downloading the same version of Cypress, it is actually cached so it doesn't need to be downloaded multiple times. Check cypress cache for more info.

@cvuorinen
Copy link

@cvuorinen cvuorinen commented Aug 22, 2019

@flotwig thanks, seems things have improved. That project is not on v3.x yet. I'll look into upgrading it.

@goodliff
Copy link

@goodliff goodliff commented Dec 2, 2019

@cvuorinen did you manage to get this down at all?

We are waiting 3+ minutes for the extraction and as we are blowing the instance away after the build and tests we need to be able to install/ extract again once the next instance starts up. I've already been asked to remove cypress as it's the only thing taking this long in the build process. (trying to avoid that)

@flotwig
Copy link
Member

@flotwig flotwig commented Dec 2, 2019

@goodliff configure your CI to cache the ~/.cache/Cypress directory, you won't need to unzip it every time. More information: https://docs.cypress.io/guides/guides/continuous-integration.html#Advanced-setup


The code for unzipping is here:

const unzip = ({ zipFilePath, installDir, progress }) => {

The unzip speed could be greatly improved if code that uses the native unzip binary was added, in addition to the macOS-specific ditto code.

@cypress-bot cypress-bot bot added stage: work in progress stage: needs review and removed stage: work in progress labels Dec 2, 2019
@flotwig
Copy link
Member

@flotwig flotwig commented Dec 2, 2019

Opened a PR to use the native unzip utility on Linux, which should be faster: #5851

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review labels Dec 3, 2019
@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented Dec 3, 2019

The code for this is done in cypress-io/cypress#5851, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@goodliff
Copy link

@goodliff goodliff commented Dec 3, 2019

Nice, looking forward to seeing whether this changes anything for us. Still looking at the CI caching options, but this will help some.

@flotwig
Copy link
Member

@flotwig flotwig commented Dec 3, 2019

I've created a separate issue for improving the unzip time on Windows: #5861

@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented Dec 12, 2019

Released in 3.8.0.

@cypress-bot cypress-bot bot removed the stage: pending release label Dec 12, 2019
@mightyiam
Copy link

@mightyiam mightyiam commented Dec 13, 2019

Thank you!

@goodliff
Copy link

@goodliff goodliff commented Dec 13, 2019

Um.... "[14:09:00] Unzipping Cypress 200% -56s [title changed]"

Not entirely sure what happened here but I'm being told that cypress unzipped to 200% when building my docker image. This is with 3.8.0 which incorporated the zipping change I believe.

@mightyiam
Copy link

@mightyiam mightyiam commented Dec 13, 2019

@goodliff perhaps better to open a new issue.

@trainoasis
Copy link

@trainoasis trainoasis commented Mar 24, 2021

@goodliff configure your CI to cache the ~/.cache/Cypress directory, you won't need to unzip it every time. More information: https://docs.cypress.io/guides/guides/continuous-integration.html#Advanced-setup

The code for unzipping is here:

const unzip = ({ zipFilePath, installDir, progress }) => {

The unzip speed could be greatly improved if code that uses the native unzip binary was added, in addition to the macOS-specific ditto code.

AFAIK you cant cache anything outside of the repo that's being used. But, you can set the Cypress cache folder in "variables" section like this:

CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/Cypress"

and cache this. This works, but saving and extracting this cache also takes ages in our case so It does not speed things up at all.

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented May 5, 2021

This issue will be closed to further comment as the exact issue here was resolved and tested.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants