Chrome 57+ Throttling

Discussion in 'Help & Guides' started by Kadauchi, Mar 15, 2017.

  1. Kadauchi

    Kadauchi Administrator Former MTG MotM

    Messages:
    4,316
    Ratings:
    +8,283
    ********************* Update Nov 2018 *********************
    *************************************************************************

    Chrome 57 has been released recently. This version introduces background tab throttling to help improve performance. This is important to know about for workers because many important scripts you use can be affected by this.

    Throttling of background tabs already existed, slowing them down to only be able to run once every second, but now they are going to be limited to an average of 1% CPU usage.

    Affected scripts

    Affected browsers
    • Chrome
    • Chrome Canary
    • Chromium
    • Opera (?)
    • Vivaldi (?)
    (?) denotes unconfirmed, but they are based off of chromium so they should be when their bases get updated to Chromium 57+


    How to opt-out

    Windows:
    1. Right click the shortcut you use to launch chrome and select properties.
    2. Add --disable-background-timer-throttling to the end of the target line, there needs to be a space separating it as pictured below.
    3. You will have to exit out of Chrome completely for this to take affect and always use the edited shortcut to launch chrome or the flag will not run.

    [​IMG]

    Mac:

    Enter this into the terminal
    Code:
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome   --disable-background-timer-throttling
    
    You will have to do this everytime you launch Chrome or you can follow these instructions: https://turkerhub.com/posts/106128/

    Both:
    You can verify that the flag is enabled by going to chrome://version and seeing --disable-background-timer-throttling under "Command Line".

    How to know if a tab can to be throttled

    Any background tab that is not playing audio or does not have a WebSocket/WebRTC will be throttled unless you opt-out.

    HIT Finder would not be throttled since it is in the foreground
    [​IMG]

    HIT Finder would be throttled since it is in the background.
    [​IMG]

    Having the scripts in their own window will prevent them from being throttled as long as they aren't minimized. You can have other windows covering them, just do not minimize them to the system tray.
     
    • Today I Learned Today I Learned x 19
    • Love Love x 4
    • Like Like x 2
    Last edited: Nov 27, 2018
  2. Hazmat

    Hazmat Survey Slinger

    Messages:
    2,151
    Ratings:
    +3,845
  3. jessers

    jessers Survey Slinger

    Messages:
    14,639
    Gender:
    Female
    Ratings:
    +44,495
    It seems like the way to do this on Mac is by pasting
    Code:
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome   --disable-background-timer-throttling
    into Terminal.

    I think. It at least didn't break anything when I did it. So. Um. Yeah.

    I also don't know if you have to do this every time you launch Chrome. So. Um. Yeah.

    :oops: Hopefully someone smarter than I will figure it out. @RicanGuy86?


    Edit:

    Or is this also it?

    chrome://flags/#expensive-background-timer-throttling
    [​IMG]
     
    • Today I Learned Today I Learned x 3
    • Love Love x 1
    Last edited: Mar 15, 2017
  4. Kadauchi

    Kadauchi Administrator Former MTG MotM

    Messages:
    4,316
    Ratings:
    +8,283
    If that gets confirmed to be working I'll add it to the main post for everyone else. That flag doesn't do anything, first thing I tested. Q2 2017 there should be an update that allows us to opt-out.
     
    • Like Like x 1
    • Today I Learned Today I Learned x 1
  5. RicanGuy86

    RicanGuy86 Survey Slinger

    Messages:
    4,451
    Ratings:
    +9,136
    The solution @jessers provided works.

    Verified by using the Chrome command chrome://verison.

    No flag:
    [​IMG]

    Flag enabled:
    [​IMG]

    The only thing is, Mac users will have to open Chrome using Terminal and specify the flag every single time they'd like to opt-out.
     
    • Today I Learned Today I Learned x 2
  6. Kadauchi

    Kadauchi Administrator Former MTG MotM

    Messages:
    4,316
    Ratings:
    +8,283
    Thanks added the info to the orig post.
     
    • Like Like x 1
  7. RicanGuy86

    RicanGuy86 Survey Slinger

    Messages:
    4,451
    Ratings:
    +9,136
    Mac users can use a simple AppleScript to create an app that opens Chrome with the flag enabled.

    This is how:

    1. Navigate to Script Editor (Utilities > Script Editor)

    2. Copy this bit into Script Editor:
    Code:
    tell application "Terminal"
        do script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome   --disable-background-timer-throttling"
    end tell
    3. Save the AppleScript as an application:

    [​IMG]

    This creates an app that a Mac user can double-click and open Chrome with the flag enabled.
     
    • Today I Learned Today I Learned x 4
    • Love Love x 2
    Last edited: Mar 16, 2017
  8. turks24

    turks24 Survey Slinger

    Messages:
    6,710
    Gender:
    Male
    Ratings:
    +13,761
    Do I need to leave there terminal window open while using Chrome?
     
    • Like Like x 1
  9. RicanGuy86

    RicanGuy86 Survey Slinger

    Messages:
    4,451
    Ratings:
    +9,136
    Yep. If you close it, you close Chrome.
     
    • Today I Learned Today I Learned x 1
  10. HardWorkingTurker

    HardWorkingTurker Survey Slinger

    Messages:
    5,675
    Ratings:
    +4,865
    UPDATE:
    You can now go to chrome://flags/
    search for Throttling
    At Throttle expensive background timers
    click "Disable"
    restart Chrome for it to work.
     
    • Like Like x 2
    • Love Love x 2
    • Today I Learned Today I Learned x 1
  11. Sheri

    Sheri Turker

    Messages:
    33
    Gender:
    Female
    Ratings:
    +6
    How do I use your script? I don't know how to catch HITs in HIT catcher
     
  12. Thomas William

    Thomas William New Turker

    Messages:
    4
    Gender:
    Male
    Ratings:
    +0
    by Martin Brinkmann on March 15, 2017 in Google Chrome - 11 comments
    Google Chrome 57 is the first stable version of the web browser for the desktop that ships with the background tab throttling power optimization feature.

    Google announced back in January 2017 that its Chrome web browser would start to throttle expensive background pages in the near future.

    This change is now live in Chrome Stable. According to the new blog post on the official Chromium Blog, Chrome "will throttle individual background tabs by limiting the timer fire rate for background tabs using excessive power".

    While timers of background tabs in Chrome were limited to run once per second already, the change throttles access to the CPU so that background tabs may use on average 1% of a core when they run in the background.

    [​IMG]

    Google notes that tabs that run real-time applications such as audio playing in the background or WebRTC / WebSockets are not affected by the change.

    The change leads to 25% "fewer busy background tabs" according to Google, but benchmarks for how that translates to power improvement has not been published by the company.

    Users may opt out of the extra tab throttling right now by loading Chrome with the --disable-background-timer-throttling flag.

    This is done in the following way on Windows machines:

    1. Right-click on the Chrome icon in the taskbar.
    2. Right-click on Chrome in the menu that opens, and select properties from it.
    3. Add --disable-background-timer-throttling to the end of the target field. Make sure there is a space between the path and the flag, e.g. "C:\Users\Martin\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --disable-background-timer-throttling
    Google created the flag for "use cases like running test suites and other sanctioned heavy computations", but it is available to all users of the browser.

    The company has long term plans for the feature (and we mean long term as the last entry of the roadmap is set to 2020+):

    1. Explicit opt-outs (~Q2 2017, when FeaturePolicy ships)
    2. Suspend all tasks on mobile (~Q2 2017)
    3. Throttling non-timer tasks (~Q2 2017)
    4. Budget-based throttling for offscreen frames (~Q3 2017)
    5. Throttling web workers (~2018)
    6. Suspend all background tabs (~2018)
    7. Remove opt-outs (~2020+)
    Google engineers plan to enable opt-outs that web apps and sites may use to opt-out from some forms of throttling. Also, in the second quarter of 2017, Google plans to throttle non-timer tasks, e.g. loading tasks, web workers in 2018, and to suspend all background tabs in 2018 as well.