2

So when I open up the computer again after standby Chrome starts to use 100% CPU by itself without me doing anything. It lasts for about 10-20 seconds.

The problem is that my battery health is around 50% and because of high CPU usage for long periods the battery can't handle it and the MacBook goes back into sleep and I can't bring it on unless I plug the power adapter even if it's charged > 90%. This is really annoying and I only have this issue because of Chrome. Any other apps I can control the CPU usage so it's not a problem.

=====

FFS, someone please help, I can't stand this anymore. This browser is destroying my life :(

In the task manager, it shows that while CPU is maximum network activity is also at max, so obviously, it's "calling home" and sending whatever. How can I block the network request, if I can't block the CPU? I have little snitch but I don't know what rule or what address I need to block.

PS: NOW after some update, it started to do this every 2-3 hours, not just after standby, and it takes about 15% of the battery when the battery is full, or it just makes the laptop go into sleep mode if the battery is below 60%.

enter image description here

13
  • Are you using a lot of extensions? These can increase CPU usage.
    – Kraigolas
    Jun 17 '20 at 1:53
  • Don't have any extensions except uBlock origin and Hangouts
    – Alex
    Sep 6 '20 at 11:24
  • Chrome Task Manager does not show your computer's total CPU usage, as Chrome Task Manager only shows the CPU usage relative to Chrome's total CPU usage.
    – Diblo Dk
    Sep 7 '20 at 11:21
  • How much RAM do you have?
    – Binarus
    Sep 12 '20 at 8:24
  • I think it had something to do with ublock origin. I disabled it for a few days and didnt encounter that cpu issue... but saw a crapload of ads instead :(
    – Alex
    Sep 12 '20 at 8:45
1

Premise

The problem you are facing is not reproducible because it depends on the number of open Chrome windows and tabs and their content. Unfortunately, even if you were more precise by posting all the links pointed to by your browser, it would not be enough because the content of the internet pages varies over time by changing the advertising inside.

However, I encountered the exact same problem with Firefox under Linux.
So not quite the same, not that far anyway.
For a better understandig of the answer read below the section Understanding what is happening. Note: I did not have time to write more succinctly...

Partial or whole solutions, raw or educated.

  • Educated. The fewer the windows open, the fewer the problems. You should decrease the number of open tabs open tabs that will go through the suspend / reactivate process.
    You can use something like One tab[1] an add-on to group open pages (windows and tabs inside) into a kind of link list, without losing them, having the ability to restore them at once (window by window) and a little to manage them. See it as a quicker, cozier alternative somewhere in between with usual bookmarks. I used it and it solved most of my problem.

  • ??? Third parties add-on to refresh automatically (or in this case with one click) all the pages. For example super-easy-auto-refresh or similar. Never used this one but it can be effective.

  • Almost raw: Reload. This has a good chance of breaking the offending scripts. You can reload heavy windows / tabs, the ones with many scripts. Usually F5 or the reload button are enough. Not cozy with many open tabs, but a patch that can result effective.

  • Educated Almost raw. Three buttons instead of one. [+] +R. Deeper than the previous one.
    You may want to use Chrome Dev Tools[3] by pressing F12: right click on the reload button will open a drop down menu.

    This menu gives you the option of doing a hard refresh, or even clearing the cache and do a hard refresh automatically. [3]

    • Ctrl+R for Normal reload (mac: Hold Shift and click the Reload button, or press R).
    • Ctrl+Shift+R for Hard Reload (mac: hold down Cmd, Shift key and then press R).
      Note: hard reload should clear the stored cache for that page.
  • Be nice. Seldom you can have the browser window not responding. With nice-n 19 chrome (renice when it is already running, or top then r for renice...) you will be able to either regain some control over that or other windows of the browser, both to decrease battery consumption, due to the less intense process of mass requests.

  • raw: kill. Raw quick and sudden solution, a sort of last resort but effective.
    You can manually kill chrome, e.g. from command-line, and restart it.
    It should be able to restore your open windows/tabs (there is an option for that inside the settings).

    pkill chrome        ## Do what it says  
    pkill -9 chrome     ## Even more raw
    killall chrome      ## Alternative
    

Understanding what is happening

When you open a window in your browser your computer executes some code from the browser itself, and some other code from the page you are loading. The more pages, the more the code requests.

On the human user's side the computer slows down, until we decide to add some add-ons in order to cut some of the unwanted process executions. Those ad-blockers interrupt some scripts they know, fool others, and globally make the computer recover speed. In this way the human user can start to increase again the number of open pages, and consequently the number of scripts to be executed if not blocked.

We tend to group similar searches and pages into different tabs in the same window, so that we can navigate them faster when needed and keep them grouped together. Those bunches of links are important enough not to be deleted, but not important enough to be bookmarked ... and they stay there longer than they were originally intended to be.

Suspending

When you go to suspend the computer, broadly speaking, the processes are frozen and the contents of the memory dumped. When you wake him up, things get right, or at least they should.

In the between "things get right" and "at least they should" lies the problem.
In almost all the open pages there are scripts that are waiting to be executed periodically (refresh, check on conditions...), and other that are waiting answers from servers. When you wake up your computer all the expected timeouts have expired. From here the spike in the CPU/memory usage and internet use.

Furthermore, such scripts (and part of the pages code) are not always written taking into account the possibility of being suspended. Then they can wait indefinitely to get a response from a server that processes an accepted request: your script knows that the server has received the request and is processing the response, the server expires the request in the meantime, the scripts after the wake-up wait indefinitely or flood requests to the server...

Other possible effects on your computer are bottlenecks due to the mass of requests to run processes simultaneously, requests on the Internet, multiple accesses to the database.

All this without considering unexpected errors in the scripts that could misinterpret a memory address changed in the meantime, a response to a subsequent instance of the same process etc. etc.Use your imagination to think of other ways that things can go wrong, it will never be enough. (One of Murphy's Laws).

Conclusion

Given the non-reproducibility of the problem, the possibility to find scripts coded not considering the consequences of being suspended, the constant chasing between scripts on pages and updates in add-ons to stop them, I am afraid there will always be irresponsible scripts when the computer wakes up. Minimizing the number of pages opened leads however to a lower exposure to this risk.

Furthermore, the choice to update each page opened after a suspension period is absolutely subjective and case depending: I might prefer to have the page with the result of a search carried out before closing the computer, another user to have the updated version after computer waking up...

1

I don't own a Mac, so I can't provide a literal solution.

However, I could imagine that you are running low on RAM. In this case, the O/S (not only OS X, but also Windows, Linux and other O/Ss) begins to swap RAM contents (of other running applications or of the same application) to disk. The blocking time you describe (10 to 20 seconds) would be typical for this scenario with many other applications running or a lot of tabs open.

You can investigate whether this theory is correct by observing the disk activity during that phase. If the disk is under continuous load during those 10 or 20 seconds (does not need to be the theoretical maximum disk load, though), chances are that we are right.

Most O/Ss provide means to monitor the swapping activity, which of course would be better than just monitoring the disk activity; however, as I don't have any clue regarding OS X, I don't know whether this is possible there.

If it turns out that RAM size is the problem, you have several options:

  • Add RAM to the machine (8 GB should be reasonable for common scenarios, but if you do CAD, image manipulation, video editing or the like, you could easily need 32 GB or more).

  • Close other applications while working with Chrome, and reduce the number of open tabs in Chrome.

  • Try to increase the speed and reduce the energy consumption of swapping itself by adding a fast SSD to your system (instead of or in addition to your HDD), provided that you don't have one already, and have the O/S place the swap file on that SSD.

1

Desperate times call for desperate measures. Use this utility to disable Turbo Boost and prevent the CPU from spiking power use: https://www.rugarciap.com/turbo-boost-switcher-for-os-x/

Limit total power to the CPU with this utility: http://volta.garymathews.com/

Disclaimer: I have not used either of these. However, in theory they should help.

Another tool for your arsenal is a Chrome extension called The Great Suspender which I use on my systems to reduce power usage from unused tabs. Supposedly recent versions of Chrome make it less necessary, but, I still think it helps. https://chrome.google.com/webstore/detail/the-great-suspender/klbibkeccnjlkjkiokjodocebajanakg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.