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

Excessive CPU usage on https://mate-desktop.org/ #29438

Closed
ryanbr opened this issue Mar 31, 2023 · 9 comments · Fixed by brave/brave-core#17852
Closed

Excessive CPU usage on https://mate-desktop.org/ #29438

ryanbr opened this issue Mar 31, 2023 · 9 comments · Fixed by brave/brave-core#17852
Assignees
Labels
OS/Desktop perf priority/P3 The next thing for us to work on. It'll ride the trains. QA Pass-Win64 QA/Yes release-notes/include webcompat/not-shields-related Sites are breaking because of something other than Shields.

Comments

@ryanbr
Copy link

ryanbr commented Mar 31, 2023

Description

Opening https://mate-desktop.org/ will cause the browser to lock up. Excessive CPU usage

Steps to Reproduce

  1. Open task manager, showing CPU usage.
  2. Open https://mate-desktop.org/
  3. Wait a few secords, watch the CPU usage increase
  4. (Be prepared to forced close the process)

Actual result:

mate

Expected result:

Don't lockup browser when visiting the site.

Reproduces how often:

Easily.

Brave version (brave://version info)

Version/Channel Information:

  • Can you reproduce this issue with the current release? Yes
  • Can you reproduce this issue with the beta channel? Yes
  • Can you reproduce this issue with the nightly channel? Yes

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields? No
  • Does the issue resolve itself when disabling Brave Rewards?
  • Is the issue reproducible on the latest version of Chrome? No

Miscellaneous Information:

Regresion timeframe:

Nightly v1.47.93 (Chromium 108.0.5359.48) Good
Nightly v1.48.2 (Chromium 108.0.5359.48)  Good
Nightly v1.48.9 (Chromium 108.0.5359.48)  Good
Nightly v1.48.11 (Chromium 108.0.5359.48) Good
Nightly v1.48.13 (Chromium 108.0.5359.62) Good
Nightly v1.48.14 (Chromium 108.0.5359.62) BAD
Nightly v1.48.15 (Chromium 108.0.5359.62) BAD
Nightly v1.48.69 (Chromium 109.0.5414.46) BAD

On windows, closing via Brave still leaves a process open that needs to forced exited in task manager..

Reported by a user: https://community.brave.com/t/mate-desktop-environment-website-locks-up-brave-browser/479454/2

@ryanbr ryanbr added priority/P3 The next thing for us to work on. It'll ride the trains. webcompat/not-shields-related Sites are breaking because of something other than Shields. OS/Desktop labels Mar 31, 2023
@ryanbr
Copy link
Author

ryanbr commented Mar 31, 2023

Possibly a Brave News related? (From @sangwoo108 )
image (1)
image (2)

@sangwoo108
Copy link

sangwoo108 commented Mar 31, 2023

It looks like we're trying to find too many feeds at once. I guess we should queue them and throttle the requests.

[20143:259:0331/223206.880796:ERROR:brave_news_tab_helper.cc(121)] OnReceivedRssUrlshttps://mate-desktop.org/
[20143:259:0331/223206.880818:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls1
[20143:259:0331/223206.880921:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls2
[20143:259:0331/223206.880970:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls3
[20143:259:0331/223206.881061:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls4
[20143:259:0331/223206.881139:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls5
[20143:259:0331/223206.881205:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls6
[20143:259:0331/223206.881271:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls7
[20143:259:0331/223206.881332:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls8
[20143:259:0331/223206.881387:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls9
[20143:259:0331/223206.881441:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls10
[20143:259:0331/223206.881513:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls11
[20143:259:0331/223206.881564:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls12
[20143:259:0331/223206.881620:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls13
[20143:259:0331/223206.881675:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls14
[20143:259:0331/223206.881728:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls15
[20143:259:0331/223206.881789:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls16
[20143:259:0331/223206.881842:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls17
[20143:259:0331/223206.881892:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls18
[20143:259:0331/223206.881948:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls19
[20143:259:0331/223206.881999:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls20
[20143:259:0331/223206.882050:ERROR:brave_news_tab_helper.cc(124)] OnReceivedRssUrls21

@sangwoo108
Copy link

Wow, Getting feeds takes really long. Each of them is quite heavy work.

@kjozwiak
Copy link
Member

kjozwiak commented Apr 4, 2023

@sangwoo108 @ryanbr definitely looks like brave/brave-core#17852 improved the performance as per brave/brave-core#17852 (comment). However, I still hit ~12-15% CPU usage on my machine and I have a pretty powerful processor. I also needed to terminate the brave.exe via the Task Manager as the process was still running around ~15% after I closed the browser. We'll get the above uplifted as it's an improvement but is there anything else that we can do to improve the above? CCing @brave/qa-team for context when they start running through the above with the next 1.50.x RC which will include the above PR.

@kjozwiak
Copy link
Member

kjozwiak commented Apr 4, 2023

The above requires 1.50.113 or higher for 1.50.x verification 👍

@sangwoo108
Copy link

sangwoo108 commented Apr 4, 2023

We'll get the above uplifted as it's an improvement but is there anything else that we can do to improve the above? CCing https://github.com/orgs/brave/teams/qa-team for context when they start running through the above with the next 1.50.x RC which will include the above PR.

Yeah, I think so. I found that each worker thread takes quite a long time to finish their job. So what came to my mind was

  • We should look into why parsing this site's feeds is that heavy. It could be fair, but could be a mere bug or something.

  • If what we want is to detect a site has feeds that brave-news can subscribe, can we skip the parsing part? It looks like we're parsing the actual feeds. If parsing couldn't be as light as we want, we could just consider that a site can provide feeds when they have URLs for feeds without actually downloading and parsing the feeds.

  • If parsing can't be skipped, we should make infrastructure to cancel it. Clearing queued tasks and killing the worker threads.

  • Also it might be worth considering using another process other than browser process, as the browser process is critical for user experience.

I believe these items are already being considered by @fallaciousreasoning , as this new feature just began.

@stephendonner stephendonner added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Apr 4, 2023
@stephendonner
Copy link

Verified PASSED using

Brave 1.50.113 Chromium: 112.0.5615.49 (Official Build) (64-bit)
Revision bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936}
OS Windows 10 Version 22H2 (Build 19045.2788)

Steps:

  1. installed 1.50.113
  2. launched Brave
  3. loaded mate-desktop.org
  4. waited 30 seconds or so
  5. noted CPU and memory usage
  6. compared results of the above to 1.49.130

Confirmed CPU usage is dramatically cut, (though still elevated), and the app is more responsive

1.50.113 - CPU usage ~40%

example example
image (2) image (3)

1.49.130 - CPU usage ~90% (I could barely open the Task Manager)

example example
image image (1)

@stephendonner stephendonner added QA Pass-Win64 and removed QA/In-Progress Indicates that QA is currently in progress for that particular issue labels Apr 4, 2023
@fallaciousreasoning
Copy link

Interestingly, it looks like every thread which gets used for parsing maxes out its CPU core. At the moment, kMaxOngoingRequests is 2 and 2 of my cores sit on 100%. Changing it to 4 uses 4.

image

I think there's probably a bug in our Feed parsing library.

@fallaciousreasoning
Copy link

Interestingly it looks like the performance hit is being caused by voca_rs::strip::strip_tags in brave/components/brave_news/rust/lib.rs. It's really, really, really slow 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS/Desktop perf priority/P3 The next thing for us to work on. It'll ride the trains. QA Pass-Win64 QA/Yes release-notes/include webcompat/not-shields-related Sites are breaking because of something other than Shields.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants