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

Cypress performance issues #8297

Closed
Jacek-fstack opened this issue Aug 17, 2020 · 21 comments
Closed

Cypress performance issues #8297

Jacek-fstack opened this issue Aug 17, 2020 · 21 comments
Labels
type: duplicate This issue or pull request already exists type: performance 🏃‍♀️ Performance related

Comments

@Jacek-fstack
Copy link

Jacek-fstack commented Aug 17, 2020

Since about version 4.11 our cypress has become insanely slow.
It hogs network like crazy [any page I'm trying to load, like this github post is taking forever when tests are running]
Failed video compression takes AGES
it logs progress every few seconds, and all I'm seeing are 1-5% increments in that time

Started processing:  Compressing to 32 CRF
    Compression progress:  8%
    Compression progress:  16%
    Compression progress:  22%
    Compression progress:  27%
    Compression progress:  32%
    Compression progress:  37%
    Compression progress:  40%
    Compression progress:  44%
    Compression progress:  48%
    Compression progress:  52%
    Compression progress:  56%
    Compression progress:  60%
    Compression progress:  63%
    Compression progress:  67%
    Compression progress:  70%
    Compression progress:  72%
    Compression progress:  74%
    Compression progress:  77%
    Compression progress:  79%

Typing has been insanely slow as well.
Tests in general got exponentially longer.
Is it only our instance or did anyone else experience it?
I'm not really sure where to look for a fix for this.
Anything you guys can point me to would help! thanks!
Also: headless seems to be WAY SLOWER then the non-headless, which is already really slow.
All in CHROME - electron doesn't seem to be affected by this.

Versions

4.11, 4.12

@jennifer-shehane
Copy link
Member

There have not been any reports of performance issues starting in 4.11.

  • Can you downgrade to 4.10? Does this resolve the slowness issue? Tracking down why the performance suddenly changed will be most helpful.
  • There may be a lack of resources on the system running the tests - You can log memory and cpu usage to see if the processes are maxed. If so, you'll want to increase the resources on the machine.
  • You could also collect all cypress logs in debug mode mode - not sure if that will be helpful here or not.

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Aug 18, 2020
@PawelWesolowski
Copy link

I have also experienced the "slowness". It is related to Chrome update and not Cypress update.
I am currently updating our Cypress from 4.1 to 4.12.1 and my colleague is having same issues on his "4.1" branch. I am on Mac and he is on Windows.
What we see is that memory usage in the Cypress' Chrome instance increases with every test (e.g. up to 10gb). It makes the tests run slower since the whole machine is running out of memory.

@Jacek-fstack
Copy link
Author

Jacek-fstack commented Aug 18, 2020

I agree that it most likely is a chrome issue - when I downgrade to even 4.8, everything is just as bad. But there's just no easy way to downgrade chrome.
I just did logging and it seems like headless takes A LOT of CPU, about 2-3 times to of the headed version. Memory is about the same. It doesn't explain network hogging though. And network usage is not that crazy.

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Aug 18, 2020

We have a tool to help track down previous versions of Chromium to download so you can run Cypress within them and track down any newer bugs: https://chromium.cypress.io/

I wouldn't really be able to track down a Chrome bug without being given a reproducible example to run against to see this specific performance issue.

If this is also happening in Electron on previous versions, then you could isolate it to a specific version as well - since those are set to a specific version for each Cypress release.

@Jacek-fstack
Copy link
Author

Jacek-fstack commented Aug 18, 2020

I was able downgrade for a few tests to 79 [stupid chrome updates itself even with auto updates turned off]. and 100% it was waaaay snappier, faster and more reliable.... until it updated to 84 again.

@Jacek-fstack
Copy link
Author

Jacek-fstack commented Aug 20, 2020

FYI 5.0 is experiencing the same slowness
a) in typing, the more consecutive tests I run (doesn't have to be run in a single run, I can just fire them manually one by one)
b) headless chrome is about 1.5 times slower, sometimes more

@jennifer-shehane how do I specify for the cypress to use an older chromium version from the link that you provided?

➜  Cypress git:(test) ✗ npx cypress run --browser /Users/jacek/Desktop/Chrome81/chrome-mac/Chromium
We could not identify a known browser at the path you provided: `/Users/jacek/Desktop/Chrome81/chrome-mac/Chromium`

The output from the command we ran was:

 spawn /Users/jacek/Desktop/Chrome81/chrome-mac/Chromium ENOENT

This is what I'm getting every time.
I downloaded the zip from here:
https://chromium.cypress.io/mac/stable/81.0.4044.92
chrome-mac.zip

@alexmonteirocastro
Copy link

I haven't been able to upgrade to higher versions since 4.8.0 because of slow typing which causes my tests to fail.

I tried the 4.12.1 and it seems that the slow typing still persists, however, it only happens on the first time the tying command is executed. On subsequent typing commands, the typing occurs at the normal speed (fast). I have witnessed this in both headed and headless test runs.

Regarding the issues with CPU usage:

Here is CPU usage for 4.12.1

image

CPU usage for 4.8.0

image

As we can see in both cases the CPU usage is quite high for chrome browser.

@Jacek-fstack
Copy link
Author

@alexmonteirocastro hmm so it doesn't slow down in 4.8 for you? That's odd, because the only thing that SEEMED to help was when I downgraded my chrome for a few seconds. 4.8 with newest chrome is behaving just like on 4.12.
And my CPU usage is ramping up to even 1000 in some cases.

@Konstruktour
Copy link

also having troubles with significant slower testruns.. (about ~2x slower)
one thing i've observed, these kind of problem occurs only on windows machines - running on linux / jenkins it is as fast as before. (tested on multiple machines)
machine 1: "browserName": "electron", "browserVersion": "80.0.3987.165", "osName": "linux", "osVersion": "Debian - 10.3"
machine 2: "browserName": "electron", "browserVersion": "80.0.3987.165", "osName": "win32", "osVersion": "10.0.17134"

@Jacek-fstack
Copy link
Author

After a LOT of testing the issue is moving from cypress 4.8 to 4.9 - this wasn't chrome's fault after all.
Also weird- but did anyone else notice cypress running happier WITHOUT external display attached to the Mac or I'm just making stuff up at this point?

@csvan
Copy link

csvan commented Aug 22, 2020

I use Cypress 5.0 with Chrome 84 on OSX and cannot reproduce any of the above issues. Memory consumption and overall speed is consistent with what we have seen for the last 6 months or so, regularly updating Cypress when a new release is available.

EDIT: Just noticed that you said Mac. Nevermind the question below.

@Jacek-fstack are you on a Windows box by any chance? The only times we have had performance issues it has been on those, and almost always due to an external program (antivirus etc) of some sort.

@csvan
Copy link

csvan commented Aug 22, 2020

Also, people struggling with this, have you tried a clean install of Cypress along with Chrome and Nodejs?

@Jacek-fstack
Copy link
Author

Jacek-fstack commented Aug 24, 2020

@csvan nope, I'm on mac and running from my host

edit: just noticed, you noticed, ignore the answer, lol

@srdjanprole
Copy link

srdjanprole commented Aug 25, 2020

This is a huge problem... with cypress 5.0.0 we have like 2k requests and with 4.8.0 we have like 100 requests...

@nicolajv
Copy link

After some research it looks like this issue started in 4.9 and is related to asset requests being cancelled and retried a bunch of times. We see it in the dev console on both electron and chrome. Downgrading to 4.8 or using Firefox we do not see this issue.
image
I replicated the issue in a test in this repo:
https://github.com/nicolajv/cypress-chromium-issue

@srdjanprole
Copy link

After some research it looks like this issue started in 4.9 and is related to asset requests being cancelled and retried a bunch of times. We see it in the dev console on both electron and chrome. Downgrading to 4.8 or using Firefox we do not see this issue.
image
I replicated the issue in a test in this repo:
https://github.com/nicolajv/cypress-chromium-issue

@jennifer-shehane can you maybe have a look into it?

@mike-tdsy
Copy link

I am experiencing the same issue. We are having to rollback our upgrade.

@nicolajv
Copy link

nicolajv commented Sep 3, 2020

Also affects 5.1

@sshaar08
Copy link

sshaar08 commented Sep 3, 2020

👍 ill follow this thread for a resolution I'm seeing the same issue re: clicks etc

@flotwig
Copy link
Contributor

flotwig commented Sep 8, 2020

Hi everyone, I have been reading through this thread, and it sounds like the main issue is that CPU is being maxed out to 100% for the duration of the test run. This can lead to other strange behavior, including requests being canceled, Cypress commands taking too long and timing out, and video compression being throttled to take a really long time.

There was a CPU performance regression introduced in version 4.9.0 of Cypress that has been identified in #8012 and will be fixed in the next release of Cypress. That is probably the reason behind the issues described in these comments.

Since this issue is effectively a duplicate of #8012, I'm going to close this thread. If, after upgrading to a version of Cypress newer than 5.1.0, your issue is not fixed, please open a new issue describing the problem and we can investigate further.

@flotwig flotwig closed this as completed Sep 8, 2020
@flotwig flotwig added the type: duplicate This issue or pull request already exists label Sep 8, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 15, 2020

Released in 5.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.2.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: awaiting response Potential fix was proposed; awaiting response label Sep 15, 2020
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: duplicate This issue or pull request already exists type: performance 🏃‍♀️ Performance related
Projects
None yet
Development

No branches or pull requests