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

Higher memory usage of Browser process compared to Chrome #21753

Open
wooque opened this issue Mar 18, 2022 · 9 comments
Open

Higher memory usage of Browser process compared to Chrome #21753

wooque opened this issue Mar 18, 2022 · 9 comments
Labels
needs-investigation A bug not 100% confirmed/fixed needs-more-info The report requires more detail before we can decide what to do with this issue. OS/Desktop OS/Linux perf

Comments

@wooque
Copy link

wooque commented Mar 18, 2022

Description

Brave "Browser" process uses much more memory compared to Chrome.

Chrome "Browser" on startup: 67MB
Chrome "Browser" after opening 3 Gmail accounts and 1 Yandex Mail: 89MB

Brave "Browser" on startup: 118MB
Brave "Browser" after opening 3 Gmail accounts and 1 Yandex Mail: 170MB

I think it mostly goes up with heavy apps, utilizing service workers.

Steps to Reproduce

  1. Open heavy apps, preferably using service workers, for example several Gmail accounts

Actual result:

Almost double the memory usage of "Browser" process than in Chrome

Expected result:

Same or slightly more memory usage of "Browser" process than in Chrome

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave 1.36.116 Chromium: 99.0.4844.74 (Official Build) (64-bit)
Revision fee9a47e86e981802390cb0d41c5ed7ea93c4f6f-refs/branch-heads/4844@{#1060}
OS Linux
JavaScript V8 9.9.115.9
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36
Command Line /opt/brave.com/brave/brave --enable-features=OverlayScrollbar,VaapiVideoDecoder --enable-gpu-rasterization --enable-zero-copy --disable-features=UseChromeOSDirectVideoDecoder --disable-smooth-scrolling --enable-crashpad --disable-client-side-phishing-detection --disable-domain-reliability --enable-dom-distiller --no-pings --component-updater=url-source=https://go-updater.brave.com/extensions --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --sync-url=https://sync-v2.brave.com/v2 --lso-url=https://no-thanks.invalid --variations-server-url=https://variations.brave.com/seed --variations-insecure-server-url=https://variations.brave.com/seed --enable-features=VaapiVideoDecoder,OverlayScrollbar --disable-features=UseChromeOSDirectVideoDecoder --flag-switches-begin --flag-switches-end
Executable Path /opt/brave.com/brave/brave
Profile Path /home/vuk/.config/BraveSoftware/Brave-Browser/Default
Variations AdRewardsStudy:NextPaymentDay
BraveDebounceStudy:Enabled
ConversionsStudy:NewDefaultPattern
Default1pBlockingStudy:Disabled
EphemeralStorageStudy:Enabled
ExtendedVariationsSafeMode4:Default4
ForceDisableBlinkFeatures:Enabled
NativeCosmeticFilteringStudy:Enabled
NavigationThreadingOptimizationsCompat:Disabled
PartitionBlinkMemoryCacheStudy:Enabled
PartitionConnectionsByNetworkIsolationKeyStudy:Enabled
PermissionLifetimeReleaseStudy:Enabled
RequestAdsEnabledApiStudy:Enabled
SpeedreaderReleaseStudy:Enabled

Version/Channel Information:

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

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields? No, memory usage is about the same, if not more.
  • Does the issue resolve itself when disabling Brave Rewards? /
  • Is the issue reproducible on the latest version of Chrome? n/a

Miscellaneous Information:

@rebron rebron added perf OS/Linux needs-investigation A bug not 100% confirmed/fixed labels Mar 18, 2022
@rebron
Copy link
Collaborator

rebron commented Mar 18, 2022

cc: @atuchin-m

@atuchin-m
Copy link
Contributor

@wooque

  1. The primary reason is that Brave stores Adblock rules and supporting code (~50Mb) in the main process.
    Therefore it is more correct to compare Brave with Chrome + uBlock. uBlock gives you an extra process that takes approximately the same amount of memory.
  2. We are planning to investigate why the difference is so much in [perf] Estimate Adblock performance impact #21603.
  3. In fact we have a slight difference (a few MB) even for disabled AdBlock. Now we consider this fact as expected, but it can be re-evaluated in the future.
    cc @iefremov

@wooque
Copy link
Author

wooque commented Mar 21, 2022

@atuchin-m I tried to disable adblock (everything disabled in brave://settings/shields, and passing --disable-brave-extension, hopefully this is enough) and saw no decrease on startup and 30MB decrease for my test case

Brave "Browser" on startup: 117MB (virtually no diff) (Chrome no uBlock Origin 70MB)
Brave "Browser" after opening 3 Gmail accounts and 1 Yandex Mail: 140MB (-30MB diff) (Chrome no uBlock Origin 92MB)

Also this usage grows even more in regular use (not this testing, adblock is on) and usually ~250MB

@atuchin-m
Copy link
Contributor

@wooque unfortunately I don't see any simple way to disable loading ablock rules completely.--disable-brave-extension is not enough.

You can try to delete cffkpbalmllkdoenhmdmpbkajipdjfam folder in your profile (/home/vuk/.config/BraveSoftware/Brave-Browser/) and restart. But after some time browser will download it again.

Also when you use uBlock/adBlock/etc in Chrome the rules are stored in the extension processes (not in the browser process). That's why it looks like Chrome takes fewer resources. То uBlock extension process should be taken into account.

BTW Brave extension is a different thing, it's not about ablocking.

250MB difference is far from acceptable, but only if the scenario/environment are the same. Is it reproducible on the fresh profiles? (adding `--user-dat-dir=<some_temp_directory>) ?

@antonok-edm Could you help us with disabling loading adblock rules?

@wooque
Copy link
Author

wooque commented Mar 21, 2022

@atuchin-m 250mb is not difference, but total memory usage of Brave "Browser" process when regularly use it for a while, I never saw such memory usage in Chrome before, I think it was mostly around 150MB after a while, so that drove me to try to reproduce what causes memory usage difference

@atuchin-m
Copy link
Contributor

@wooque I got that you mean.
Well, adblock rules definitely add an extra 50-60MB of this difference. The rest diff can be explained by differences in profiles/extensions/cache/etc (or in theory also can be a bug/non-optimality that consumes extra memory).
If you have a reproducible difference 250mb vs 150mb could you please share the scenario?

@iefremov iefremov added the needs-more-info The report requires more detail before we can decide what to do with this issue. label Mar 30, 2022
@iefremov
Copy link
Contributor

@wooque just curious if you have anything checked/non-default on brave://adblock?

@wooque
Copy link
Author

wooque commented Mar 30, 2022

@iefremov nothing is checked and I have 11 custom filters

@atuchin-m
Copy link
Contributor

#22339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-investigation A bug not 100% confirmed/fixed needs-more-info The report requires more detail before we can decide what to do with this issue. OS/Desktop OS/Linux perf
Projects
None yet
Development

No branches or pull requests

4 participants