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]: Slow Execution of Frontend Tests on Mac M1 #19894

Closed
Akhilesh-max opened this issue Mar 6, 2024 · 14 comments
Closed

[BUG]: Slow Execution of Frontend Tests on Mac M1 #19894

Akhilesh-max opened this issue Mar 6, 2024 · 14 comments
Assignees
Labels
bug Label to indicate an issue is a regression Impact: Medium Will improve quality-of-life for at least 30% of users. Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet.

Comments

@Akhilesh-max
Copy link
Contributor

Describe the bug

I’ve been running the Oppia frontend tests on an M1 Mac and have noticed that they are executing significantly slower than expected. On average, it takes around 40-45 minutes to run the existing 8941 tests.

This extended execution time could potentially impact productivity, especially when running tests frequently during development. It might also discourage thorough testing if developers are waiting a long time for test results.

Screenshot 2024-03-06 at 9 46 35 PM

URL of the page where the issue is observed.

N/A

Steps To Reproduce

Run frontend tests on Mac m1.

Expected Behavior

The execution of the 8941 tests should ideally complete within a time frame of 3-5 minutes. This is based on the assumption that the system running the tests has adequate resources.

Screenshots/Videos

No response

What device are you using?

Desktop

Operating System

MacOS

What browsers are you seeing the problem on?

No response

Browser version

No response

Additional context

No response

Tips for developers

Before addressing the bug, please identify which PR caused the issue (you can follow the steps here). If you identify the PR, comment on the issue with a link to it. If not, mention the commit hash of the oldest commit you saw the bug on (and the month and year it was made in).

Also, if this is your first issue, please make sure to follow https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue and https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up before claiming it. Thanks!

@Akhilesh-max Akhilesh-max added triage needed bug Label to indicate an issue is a regression labels Mar 6, 2024
@seanlip
Copy link
Member

seanlip commented Mar 7, 2024

@Akhilesh-max Thanks for reporting. Some questions:

  • What are the full specs of your machine?
  • Is https://stackoverflow.com/questions/19683846/why-are-my-angularjs-karma-jasmine-tests-running-so-slowly relevant?
  • Does anything else run slowly on your Mac, or is it just the frontend tests of Oppia?
  • Could you ask around (on discussions, team chats, etc.) to see if anyone else is running into this issue and what specs their machines have? Let's try and see if there's any commonality between the folks who run into this issue, and that is different from the folks who don't. Otherwise it's not clear whether the issue is M1 chips or something else.

Thanks!

@Akhilesh-max
Copy link
Contributor Author

Akhilesh-max commented Mar 7, 2024

@seanlip
I am using MAC m1 :
Hardware specs ::
Screenshot 2024-03-07 at 10 15 22 PM

software ::
Screenshot 2024-03-08 at 12 22 08 AM

memory usage during execution ::
Screenshot 2024-03-07 at 10 57 27 PM

I think, perhaps this ain't the reason.

Also, the problem continues with the end-to-end (e2e) tests as well. Running the learner dashboard test took me 16 minutes. The situation becomes even more peculiar with the Lighthouse tests. However, the acceptance tests seem to be running well, taking between 30 to 120 seconds for each suite, depending on the specific suite.

I tired following the suggestions in the reference. However, even running the e2e tests without minimizing or changing the tab, does not helps much.

I will open discussion to see if there are other folks facing similar issues either on the same or any other device.

@Akhilesh-max Akhilesh-max self-assigned this Mar 7, 2024
@Akhilesh-max
Copy link
Contributor Author

@seanlip Interestingly, switching from ChromeHeadless to ChromiumHeadless resolves the issue, and the entire frontend tests completed in just 3.9 minutes in the same machine.

Take a look:
Screenshot 2024-03-08 at 2 15 13 AM

I guess, the problem might be due to Chrome not being fully optimized for the ARM architecture, which the Mac M1 is based on. Previously, there were no such compatibility issues with Intel-based chips (x86 Architecture). Could this be the reason for the observed behavior? However, I’m unsure if we can move to chromiumHeadless.

@seanlip
Copy link
Member

seanlip commented Mar 8, 2024

@Akhilesh-max That's great! So it seems like the issue is Chrome rather than the tests.

Is Chrome much slower when you're regular using it too, or just in the karma env? There are some mentions of that online, but I don't know if the solutions help.

I'm totally fine with switching to ChromiumHeadless but we can't really do this globally since not everyone has Chromium. But if you can configure karma to use either one (or even Firefox) based on a per-developer system preference then I think that should be fine. Do you want to have a go at that?

@Akhilesh-max
Copy link
Contributor Author

Akhilesh-max commented Mar 8, 2024

@seanlip Actually Headful or non-headless chrome works pretty fine otherwise, may be the issue rests with the optimisation of Headless with the ARM architecture.

Also, I was thinking to use the Karma Detect Browsers plugin to identify the available browsers on the machine and prioritize them in the following order: ChromiumHeadless, ChromeHeadless, and FirefoxHeadless for the execution. If there are any issues with the plugin or it doesn’t function as anticipated, I plan to default to ChromeHeadless.
Does that sound correct?
If not, please suggest.

@seanlip
Copy link
Member

seanlip commented Mar 8, 2024

It seems reasonable. I don't have a strong opinion; as long as it works and it's conceptually easy for developers to understand what's going on, I'm fine with anything.

@seanlip seanlip added Impact: Medium Will improve quality-of-life for at least 30% of users. Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. labels Mar 18, 2024
@Akhilesh-max
Copy link
Contributor Author

Akhilesh-max commented Mar 28, 2024

@seanlip, interestingly, the issue of slow execution of frontend tests on my Mac M1 has unexpectedly resolved itself. This happened despite no changes to the karma configuration file, and I’m still using the same device and ChromeHeadless for testing. I’ve been unable to identify any recent PRs that could have led to this. I also reviewed the release notes for the latest version of Chrome (123.0.6312.87), but found nothing relevant. The last time I ran the tests, it was on Chrome version 122.0.6261.94. Also, I confirmed It with another team member with a Mac M1 and the issue has been resolved for him as well. Could it be the new release of chrome?

@seanlip
Copy link
Member

seanlip commented Mar 29, 2024

Thanks @Akhilesh-max, I'm glad it resolved itself and I appreciate your keeping the issue updated.

Yes, that is certainly a possibility -- in these sorts of things, one needs to focus on "what changed", and Chrome is one of the possibilities. (It's unrelated, but you might find some of these stories amusing.)

Should we close this bug then?

@Akhilesh-max
Copy link
Contributor Author

@seanlip, thanks. It really would be interesting to go through these lores.
I agree that since the issue has been resolved, it seems ok to close it.

Additionally, should we consider documenting the typical duration (assuming sufficient resources) for these tests to execute properly in the wiki docs? I’ve been in contact with another contributor who also uses an M1 and has been with Oppia for a while. He experienced something similar and felt it was normal. Perhaps this information could be useful to others.

@seanlip
Copy link
Member

seanlip commented Mar 29, 2024

Additionally, should we consider documenting the typical duration (assuming sufficient resources) for these tests to execute properly in the wiki docs?

Sure, go for it. Feel free to open an issue on the wiki repo and assign it to yourself if you like, thanks!

@seanlip seanlip closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
@seanlip
Copy link
Member

seanlip commented Apr 3, 2024

@Akhilesh-max Have you filed the bug yet? If so, please link to it here, thanks!

@agallop
Copy link
Contributor

agallop commented Apr 3, 2024

Additionally, should we consider documenting the typical duration (assuming sufficient resources) for these tests to execute properly in the wiki docs? I’ve been in contact with another contributor who also uses an M1 and has been with Oppia for a while. He experienced something similar and felt it was normal. Perhaps this information could be useful to others.

I also used to experience long testing times and didn't think much of it. It's much faster now. I can provide you with my specs and (present) execution times if that helps with documentation

@Akhilesh-max
Copy link
Contributor Author

oppia/oppia-web-developer-docs#302

Here's the issue link.

@Akhilesh-max
Copy link
Contributor Author

Hi @agallop, could you please share the current duration of the execution and the device you're using? This information could be helpful for our documentation. For reference, I'm using a Mac M1 and the execution time is now between 3-5 minutes.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Label to indicate an issue is a regression Impact: Medium Will improve quality-of-life for at least 30% of users. Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet.
Projects
Archived in project
Development

No branches or pull requests

3 participants