Chrome will aggressively throttle background tabs
blog.strml.net
blog.strml.net
var doVisualUpdates = true;
document.addEventListener('visibilitychange', function(){
doVisualUpdates = !document.hidden;
});
Basically, you can use this to determine if your tab is running "in the background" and avoid redrawing/refreshing components to show updates that won't ever be seen.[1] https://twitter.com/cryptowat_ch/status/817502626896089090
https://www.npmjs.com/package/visibility is a nice little package that encapsulates some of the browser compat issues, if you have out-of-date clients.
https://gist.github.com/STRML/cc368c46c2d7de8679196e69ddbcae...
The key is, even in your case (with price alerts), you'll still want to tick occasionally, thus the `FORCE_TICK_INTERVAL`.
React's own batching is smart enough to merge the work. For example, before the next tick, one component calls setState() 20 times, another calls it once. Only one rerender will actually be done.
Some more discussion on rAF batching here: https://github.com/petehunt/react-raf-batching/issues/8
I see this done via debouncing for render operations that happen on repeated events, for instance typing (send query to server, then show matching results in a render of some list).
_needsrender = false;
function render () {
_needsrender = true;
}
requestAnimationFrame(function hardrender () {
if (_needsrender) {
.... do stuff ....
_needsrender = false;
}
requestAnimationFrame(hardrender);
});In addition to requestAnimationFrame this could be very handy!
Are there any gotchas you have experienced in using this API that I should look out for?
doVisualUpdates = (document.hidden === true);In general, the mantra for people who find this tough to fix should be, "Why didn't I use MVC, what a cretin I was!"
What might he be talking about? Well, it works something like this...
- The app fetches data from a server.
- The data is processed. This may be cheap, or expensive.
- The DOM is updated.
- The page layout is recomputed.
- The browser window is redrawn.
Certainly, the browser could skip the last step for invisible tabs. It can't skip redoing the layout, as the JS can read the computed layout back out; at most it could do the computation lazily, but that would be extra code and complexity. Everything prior to that step isn't under the browser's control.
The web-app coder could act on every single step in the chain, starting by throttling data fetches.
Why redraw an invisible window? In any ordinary paint routine, you query for the invalidated rectangle and only redraw what you must. In the case of pages that are out of view, then nothing needs redrawing.
Processes that are busy doing things they need not (like redrawing on a timer, polling a mouse) is why Apple starting highlighting offenders in macOS (what is hogging the battery??) and why I don't use Chrome on it - it just gobbles power keeping all of those tabs alive.
Hopefully these new changes will help.
if (typeof window.document.hidden !== 'undefined') {
hidden = 'hidden';
}
else if (typeof window.document.msHidden !== 'undefined') {
hidden = 'msHidden';
}
else if (typeof window.document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden';
}
doVisualUpdates = !window.document[hidden];
reference: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibi...https://developer.mozilla.org/en-US/docs/Web/API/window/requ...
Firstly, I want to make clear that we are not shipping this in Chrome 56. We have enabled throttling as an experiment in beta channel to measure impact and collect feedback from web devs. We will aim to ship it in Chrome 57, subject to further feedback.
In response to concerns voiced we will disable aggressive throttling when active websocket connection is present. Tabs playing audio are already unthrottled.
We will also consider more signals to use in exempting a page from this throttling: metatag, pinned tabs, permission to show notifications from user. Please leave a comment in the bug (crbug.com/650594) if you have other suggestions.
Looking forward to your feedback, Alexander.
So, for me, +1 for pinned tabs != throttled.
The pinned tab for GMail has a blue dot for "attention needed". Though this is suboptimal because I think it represents both IMs and new mail.
Unpinning and restarting my browser brings them right back in pinned state, and it seems like nothing I do short of reinstalling my browser profile corrects this.
I've seen this happen on multiple machines, so I feel like it can't just be me.
Though I'm not sure how popular this feature is and I would vote for other ways to turn throttling off, especially for those which prompt user about it.
Does this extend to SSE?
I'd recommend a different background color for the tab, except that I'd also like to see (sign in) profiles have distinct background colors to aid the user in keeping their profiles straight.
Realistically, you just can't use the Chrome task manager to find slow tabs :/. I'd argue that Firefox's recent work in about:performance is actually more useful for this purpose (though isn't very good at dealing with large numbers of tabs that are each using only a small amount of CPU; the real solution to that, though, should just be tab suspension).
I'd also appreciate it if nothing the website can do can override that. If I mute the audio, then it shouldn't be a signal, and you'll want to avoid using signals which the websites can trigger without user action.
Honestly, I'd prefer if there was some way to entirely suspend event processing on a tab, or at least timers.
I'm a laptop user and CPU-hungry background tabs are a huge drain on my battery life. If something is opting out of or otherwise excluded from throttling, I want to know about it.
Thanks.
I'm not saying this to be pedantic, just trying to nip this entitled vendor mentality in the bud. "We're important so give give give without asking." It's a bit what you see with permissions on mobile: the more famous a company is, the more brazen a permission policy they can get away with. It's only tangentially related actual functionality of the app.
This is not about you personally, by the way, but about vendors. You just shouldn't let them get away with it. Even if they're slack :)
The user ultimately needs to retain control. And I'm especially interested in the exception for audio - that really should be user-controllable, otherwise it just encourages annoying page authors to be even more annoying.
When I did support for Apple Care, every single update if it had new or extra icons we always got lots of calls like this.
The pages that are most aggressive in being a drain on resources, in my experience, are also using websockets to constantly load in new advertising and JavaScript and other garbage. Just "the page has a WS open" should not be enough to keep a page unthrottled without providing the user a chance to change that behavior.
To me the fundamental issue is one of user control. If the user wants the site to run in the background, great. However a lot of times they don't even know that it is and, surprise! the battery is drained, or everything is running slow and it's time to press shift+esc and stare at the jumping percentages in the task manager.
So to that end, communicating what's going on to the users, is I think pretty important so hopefully:
* A Visual Indicator on the tab, similar in spirit to the speaker or red recording circle, that conveys
1. Tab is fully utilizing its throttle.
2. Tab has throttling disabled by user-request.
And then to give users control:* The ability via `site settings` to disable the throttling, however if a site is using excessive background resources, some sort of ui should show indicate such.
(A lot of this would be almost trivial by showing little cpu use bars, with a line where the throttle is, but it might look kind of ugly)
Even though this is going to break some of my apps, I can see a greater good here, and I am 100% for helping out with battery life, and preventing my machine from being some sort of ad network computation shard. So I am fine with this being the default option even though it will break apps I have written. They are mostly in house tools so as long as I can instruct users to override the throttle, provided I am given that option, which it seems like I will be.
I would figure that for larger more public facing devs, the experience might be a bit more tedious. Perhaps a unthrottled-background permission request API can be done. And hopefully for legacy sites that won't be updated, the visual indicators above will clue users in as to fact that the browser is throttling the site. Perhaps ugh I hate even suggesting this, a nag bar could pop up when the user navigates back to the tab to inform them that the site was aggressively throttled.
Anyhow, I am glad you guys are getting out ahead of this, I think this stuff is going to get worse as sites seek to run more code on our machines in ways we cannot easily discern. So I actually don't like that workers / websockets / audio work around aggressive throttling, because the bad actors are just going to use that to burn cpu in the background without the users consent. Hopefully if executed well, with a helpful ui, this can be used to stop any unwanted and often unseen but still felt cpu waste while allowing sites the user actually does rely on to continue working.
ps, I'll cross post this to your tracker as well as you requested, I just know that leaving it here will get more eyeballs from a larger community to give their feedback as well.
Make no mistake, I do believe Chrome could benefit from this, and I do believe what Microsoft is doing is skirting the edge between ethical and non-ethical (okay, I think it's sleazy). But it just seems like a curious coincidence.
I provide notification access to news sites, not sites I want constantly burning my CPU. This is "throttling", not "100% suspending forever", right? There's no good reason to give more CPU to these tabs that might be occasionally wanting to tell me something from the background: as they are in the background that's the only thing they should be doing, and if they are currently doing other things they should have a strong incentive to stop doing all that other stuff when they detect going into the background: there should be no exemption for tabs with notification access.
As an example - I never listen to audio/video in a background tab, but I have to suffer battery loss because of features that I have no plans to use.
The main problems I have with background tabs and resource use is advertising iframes on otherwise inert pages. iflscience.com and sometimes imgur.com are two notable offenders here in my experience.
Advertisers will opt of anything that might throttle their content whether they need to or not, without testing if they need to, just in case. so if there is an opt out I expect it to be abused such that this pain point will not go away.
As well as asking if a particular domain should be allowed to unthrottle itself as others have suggested (or instead of if there is a fear that extra UI interactions will confuse the user) perhaps you could only allow it if the top level frame also opts out? This would give control back to the main page maintainer and if used in combination with the prompts could confuse less technical users less (the request for unthrottling comes from a recognised name like iflscience.com not content.idofmachineinfarm.r438957432t43.somecompanyyouveneverheardof.com)
> disable aggressive throttling when active websocket connection is present.
How is "active" defined here? I foresee advertisers opening a websocket that does as little as possible in order to get a prompt-less lifting of the throttle...
> Tabs playing audio are already unthrottled
I'd love to reverse this and punish tabs that play audio in the background! (or to allow for genuinely useful uses, such as message alerts, punish those that play more then 5 seconds of audio in a minute, unless tey are whitelisted).
White-listing youtube would be one click for ever (potentially) and the same for other similar sites (vimeo, maybe facebook, ...) - in fact not even that as common sites like that could be on the list by default (as long as there is an easy way to de-list them).
I use a LOT of tabs, and the best plugin has been The Great Suspender. Highly recommend it for anyone who wants memory & CPU back and keeps many tabs/windows open at once: https://chrome.google.com/webstore/detail/the-great-suspende...
tl;dr - Great suspender is even "more aggressive" than the outlined throttling, as it fully suspends the page and returns all CPU and RAM to you, so it's a great solution for people interested in throttling background tabs.
I hate having more than 6-7 simultaneously open because it gets increasingly harder to keep an overview of what you're doing. The same applies for IDE tabs or windows. Too much of them and finding the right one becomes increasingly hard, and losing the thread more likely.
So I leave them open until the computer can't handle it.
I always close them, most aren't needed for a long time.
But if I need stuff I closed I just hit 'reopen closed tab' a few times.
I typically have 100 or so tabs in Firefox. I did get over 600 once, but that's too many ;-)
My open tabs are kinda like my working memory. I could close them and reopen them as needed, but it is easier to just click a tab then to try to find the thing again. In addition, sometimes the pages I am looking at have dynamic navigation, and closing and reopening the page will require a good deal of navigation to find the section I was looking at. Plus, the overall time to reload the content, where if I just have the tab open there is no download time.
Also, the tab icons help me remember what I was looking at. I will often keep tabs open for what I wanted to read later.
As for read-later, I usually pull them into the bookmarks bar (top level, directly visible) to free up some space.
I'd recommend using one of the extensions instead.
The only bad thing is realizing you have a couple hundred old tabs to go through and delete. They really add up over time.
If I want to add a new tab instead of finding the old I can press shift (IIRC).
In addition, you have to take the time for the page to load, you have to delete the bookmark later if you dont want to clutter up your bookmarks, etc.
On the other hand I rather use native apps, when given the option.
Which I also only keep the ones for the task at hand open.
I'm more of a less is more guy, when it comes to windows/tabs.
I use many tabs as a stack of pages when debugging, researching, or reading aggregate news feeds (reddit, hn). It usually starts with a Google search or two, in which I open all links I think _might_ be relevant based off of what information google can provide me from the results page.
From there I read through each and open any further tabs if anything is linked too in the text (I hardly ever actually click navigate, it's most always a new tab). Generally this only goes about 3 deep (search, first page, sub links). I will close any pages that I find have no useful information, but if there is anything I think might be useful in the next 30 minutes I just leave it open. I do this for each of the results I originally opened. Somewhere in the 7-15 tabs generally is the answer I'm looking for or at least there is enough information I can answer my question. If any link is particularly beneficial, I will bookmark it. Generally the time span I have a large number of tabs open is no more than an hour before I'm finished and close everything out.
Chrome handles this nicely, if you are on a page and open a tab, it will place the new tab next to the current tab, instead of at the end of the tab list. Some sort of tree tab view would probably work much better for this, but Chromes behavior isn't bad for what I do.
What I'd really like, though, is a 'close all descendant tabs' option.
I don't use favorites or bookmarks because usually I don't need a link permanently.
Edit: I actively try not to get too many. If it starts to hide the title/favicon completely I start to close them again until I can recognize them by title without clicking through them.
I use my tabs like a generational garbage collector. Tabs to the left of the current tab are processed, tabs on the right are to-be-processed. I'll go to a page like reddit or HN and spin off a dozen tabs of things to read. Then I'll go through one by one and either process, delay or close.
Once I reach about 250 - 300 tabs, I'll do a longer generation sweep and go through all the tabs and try to get it down to less than 100 or so.
Basically, I'm never in need of finding any specific tab. If I want the content from that tab, I'll just open a new one and navigate back to that point. The tabs are really a lightweight to-read list.
Why do you need an overview? It's like stack frames: you can limit your scope to what you're currently doing. The other tabs represent stuff that's "parked" and you aspire to come back to.
(This is why tabs are better than windows for this, because they maintain a linear order while most systems will re-order window order if you visit the windows)
My tab-opening habits predate tabs, because I was raised on Netscape Navigator with a modem using "open in new window" instead. I would read down a page and open interesting-looking hyperlinks in the background, so I didn't have to wait for them to load. Another advantage of this technique on modems was that I could close down the line and carry on reading.
Incidentally, the note papers floating around on my desk works in a similar way, although they are more of an unordered set. Only one or two are relevant, the rest were helpful at some point but no longer are. Cleaning my table usually results in me dumping the whole thing in the dustbin.
Leave open the tabs you know you'll need soon(ish) and let the Great Suspender throttle them, and save (then close) groups of tabs/windows you won't need right away using Session Buddy.
https://chrome.google.com/webstore/detail/session-buddy/edac...
"""
Advantages over The Great Suspender:
- More memory savings
- Compatible with chrome tab syncing
- Super lightweight extension that uses no content scripts or persistent background scripts
Disadvantages over The Great Suspender:
- No visibility on which tabs have been suspended
- Unable to prevent a tab from reloading when it gains focus
"""
1. a tab exceeds its quota and throttling kicks in;
2. you visit the tab to check why it stopped working;
3. you get a permission pop up (like all others) once you visit the tab again, asking you whether you want to allow it unlimited resource usage, noting that it'll decrease battery life of your device.
www.foobar.com wants to:
"Run in the background unthrottled"
I'm not sure if that's a good thing or a bad thing. After all, backward compatibility is how we got the semantics of an alert() dialog stopping all JS execution.
request for location doesn't require the page to explicitly indicate a desire, the request is triggered if the page attempts to use the location services of the JS API. sites that want to run unthrottled can't be identified simply by the usage of a certain API, so the developer would need to add something explicitly to their markup to indicate the desire.
i want control over the feature regardless of whether or not the site's developer deems it appropriate.
"Don't throttle pinned tabs"
You can see the discussion back and forth, here: https://groups.google.com/a/chromium.org/forum/#!topic/blink...
I can see where that will end up though. Everyone who's app was broken by this change will start playing zero volume audio, then the exception will be yanked back.
With the web poised to be the new platform for applications, there really needs to be some more thought put into how to accomplish that goal. The chrome devs already sunset some solutions in that space, like the HTML5 app cache. Now this. Nobody likes a constantly moving target.
What do I know though? I don't normally listen to audio on the web...
On the other hand, if they are using Pandora or similar, the end user probably wants the background tab playing and doing other work (showing current album cover art or whatever so it's there if you switch back to that tab).
https://chrome.google.com/webstore/detail/tab-pinner-keyboar...
I have an option set in FF's about:config that disables loading of my pinned tabs on startup, so I regularly keep 200-300 tabs open and only activate the ones I need.
Sometimes it takes weeks to clear my tabs because I barely see a performance hit from having so many open.
Extending that functionality to throttling seems natural to me.
I swear to god if I see anything mentioning a battery on a desktop machine with no battery...
All I know is that my desktop runs at about 70W idle vs. 450W fully-loaded. Unnecessary use of the CPU wastes money regardless of whether or not you're using that money to charge a battery.
IIRC, most of the browsers are going to do away with this functionality soon, however.
This seems like a step towards the way things work with mobile apps currently, where the app's main thread gets suspended when its not in the foreground, and background processing happens in separate threads which the user has some degree of control over.
Edit: I meant regular `Worker`s, not `ServiceWorker`s.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Worker
... which may actually be the right solution.
Unless I'm supposed to re-implement tabs within my single page application and then force it to only let one tab run, which I guess is possible but horrible :)
If you have several tabbed views, then you would include tabs in your application.
And yeah tabs in JS are possible and I might go down that route, it'll just be a lot of extra work to replicate a UI that already exists fine.
Opening another tab creates a new bakery, not a view into the same bakery. (This only works if you haven't played before or clear your cookies.)
Edit:
If you really want to keep the same functionality then you would need to bring server communication into the mix. It's possible to either run the simulation server-side, or at least communicate the state between tabs using a server.
If you send an email in one Gmail window and it shows up in the other window, then I would guess it receives a message from the server to update.
Maybe use electron or something?
> It is a pure SPA, you just have the option of opening multiple instances at the same time. Like I can open gmail in two tabs, but it's still an SPA.
Gmail just runs the UI in the browser though, the actual work of processing, receiving and sending mail is not done in a tab. The tabs are just views into the system.
It sounds like you are having one tab as both the client and the server, and separate tabs as clients to that other tab, which is pretty edge case.
As someone else suggested, you could move the processing to the server, but I imagine that's not feasible because then you are centralizing the processing and you're paying for processing, not the people visiting.
The more appropriate way to architect this (to my eyes, so take it for whatever you think it's worth) would be to use JS to manage tabs within the application (which you mentioned elsewhere already). The really simple way to implement this might be to have the JS tabs just contain an iframe to the prior implementation's real separate tab URL (since it already works that way, there's not likely to be any security issues you have to deal with).
<iframe src="the url" width="50%" height="50%">
<iframe src="the url" width="50%" height="50%">
<iframe src="the url" width="50%" height="50%">
<iframe src="the url" width="50%" height="50%">
There's also the <frameset> and <frame> tags to divide pages between URLs.but chrome does not like that and is always nagging and trying to trick you into installing the latest versions.
i looks like we will have to package it as electron app.
</sarcasm>
Cost is a real concern for these things. The tradeoff is running things on client or expensive backend or spending ages building a custom, efficient backend.
I prefer Firefox, but since Google broke Google Voice (now Hangouts) plugin for FF users, I've been grudgingly opening a Chrome browser each time I want to make a phone call to US number.
Would it be possible to just declare "Best played in Firefox?" It's a bit gauche, but if a browser's engine has a behavior that isn't really compatible with what you intend to do, that's the browser's fault.
And just let us allow tabs to grab all the resources they want on a opt-in basis. Why not?
* Before anyone brings up the inevitable economic argument - it wouldn't take a lot of man hours to do these things, I dare say it would just take one or two persons who are capable to be willing and allowed to do them. And compared to all sorts of things that browsers vendors made and get scrapped, you at least know tabs will always use ram, CPU and load assets over the network, so it's not ever going to be completely useless.
And to repeat myself, I really do miss something akin to the icon that displays which tabs are playing sound -- not for myself, but because it would allow people to notice the difference between bloated and well crafted pages more easily.
I appreciate they prefer to automatically decide what is best, but I would prefer more gauges, at least as an accessible option. If you hide something behind an "advanced" label, it will just scare people off for no reason. It's not like configurations dialog aren't kinda barren and padded as is. Just fix that and then just put things there, neatly categorized and maybe even searchable, and explain them. People can drive cars and vote for politicians, but we can't trust them to read? Just about any image viewer or video player seems to think more highly of people than browsers of all things do.
Besides directly providing information that is relevant to a typical user, I'd hope such a solution would finally put some pressure on the companies to optimize their webpages.
The browser has increasingly become universal platform. On the one hand, this means applications written for browsers are automatically cross platform. But this also makes the browsers more and more complicated. Even the simplest webpage takes a significant hit in resource usage.
Maybe we need some sort of "reduced web". A browser that only supports the essential features to display webpages. No WebGL, canvas, notification, WebRTC, locations, WebMIDI, or WebUSB (seriously!). And I don't mean just disable these features, but rather design the browser without them. Then we could do most of our browsing in the minimal browser, and only fire up chrome for the more demanding web apps.
If you really think I should be running something in the background, you should ask Chrome for that permission so Chrome can ask me. If I say yes, then feel free, but no website should have this for free.
Why not? Your applications on the desktop can run background tasks without your approval. Your phone's applications on iOS and Android can run background tasks without your approval. The web has tons of web applications some of which more complex than stand alone apps. So why wouldn't they be afforded the same?
Asking would be a bit of a UX nightmare. You'll have so few users enable it. It's a pattern they've never seen before.
FYI, I switched to iOS because they're much more aggressive controlling about runaway background processes.
Apps on iOS can only do this for a short time interval before they will receive a SIGSTOP and are no longer allowed to execute at all; and while you can react to push notifications, you are given a very limited time interval in which you can do that locally. You can manage downloads in the background, but those are passed off to a dedicated download process to make sure you aren't doing anything complex (as a download should not be a major CPU drain: it is really just something that has to respond to I/O events). You can play audio or track location actively in the background, but the system makes this incredibly obvious by placing an omnipresent and highly intrusive banner at the top of the screen, telling you which application is doing that. You can manage bluetooth devices in the background, but if you are paired with a bluetooth device then the user probably understands what is happening.
Background tabs usually do not have a visible impact for user (tabs with audio are always considered foregrounded).
I'd guess there's a lot of shared memory between tabs
Measuring memory usage is hard on a modern OS.
Not in the slightest. OS's have to allocate virtual memory to each process or that process with SIG-FAULT when it touches invalid memory.Tracking per-process memory usage is one of the most trivial things OS/Pref tools do.
Defining it is what's hard.
how much memory is each process using?
20MB. Oh but they are sharing the pages the executable is mapped into.
So how can you can you say they are each using that much RAM?
Because that 10MB of RAM won't be freed until the last process exits. Each process is using 20MB of physical pages. If only 1 was running it would use 20MB.The semantics that each process is sharing 5 HUGEPAGES of heap isn't really important as even if 1 was running alone it uses that much memory.
If you are sharing that much data with executables that you have this problem there is some low hanging fruit for memory optimizations you can do.
Oh but you aren't *actually* using 60MB of Heap, only 40MB
Indeed. And in cases where these 3 children have the same parent you look at the ParentMem + 40MB (child binary+individual heaps) to report a better picture.Shared/unshared semantics are not hard. Have you ever read /proc/$PID/maps ? Because it clearly labels what is/isn't shared physically. When you are optimizing for memory usage you rarely look at shared readonly pages as the kernel put them there for you.
Defining it is what's hard.
Injecting an interpretation before taking a measurement is not sound science or engineering.Measurements inform Interpretation. Not vice versa.
It doesn't really make sense to ask "how much memory is this process using?" Instead, you want to ask questions like "how much memory are all of these processes using?" or "how much memory would be freed if I terminate these processes?" or "how much extra memory will be used if I start another process?"
What's hard is understanding which question you want to ask in any given situation.
There's no right way to do it.
What's hard is understanding which question you want to
ask in any given situation.
I don't see the issue. You admit that answering all of these questions is easy. The hard part is lawyering which question to ask.This is not a data reporting problem.
This is a data interpretation problem.
A good reporting tool should not be interpreting (or forcing an opinion) on the end user.
You believe this problem is hard because you are forcing an interpretation to exist before you take a measurement. When you should not be interpreting until after measurement. Injecting an interpretation into a measurement process fundamentally changes that measurement.
Measurements inform your interpretation. Not the opposite.
TL;DR You put the cart in front of the horse.
That's what I said. "Defining it is what's hard."
You seem to understand what I'm saying, and agree with me, but insist on arguing for some reason I cannot comprehend.
You seem to understand what I'm saying
and agree with me
Literally the opposite. Your initial statement was Measuring memory usage is hard on a modern OS.
Which you've agreed was false as /proc/$PID/maps is easy to read. Then said: Defining it is what's hard
But these statements are not mutually inclusive nor does the later imply the former.I stated measuring is literally the simplest thing. You said ah but what you measuring. That isn't dependent on the tools, or OS. So why did you state it was?
Are you just arguing with me because you didn't realize I was somebody else?
As a typical computer user, this is what I care about:
- who the frak is eating all my RAM?
- which processes should I kill to get some memory back?
Whatever the weird sharing things are going on, the memory is ultimately linear. So show me a large rectangle subdivided into sections, each one representing memory associated with a set of processes. One section for "this memory is used by Chrome.exe". One for "this memory is used by Chrome.exe, X.exe and Y.exe". One for "this memory is free".
When I click on a section, it should highlight all the processes that share this memory. When I click on a process, it should highlight all the sections this process uses or shares with others.
This way, I could quickly see who's wasting my RAM and how many processes do I need to kill to get some chunk of memory back.
Exactly, I usually find that chrome is eating a little more than what it's displayed in task manager in windows ;) I have no idea how it can achieve that to be honest. Restarting it seems to bring back the 5-15% missing ram in my case.
People who have extremely unstable/inconsistent experiences with these platforms usually have a rogue extension or some other problem lurking beneath the surface.
Also consider occasionally VACUUMing your browser's DBs, and on Firefox, taking advantage of the profile reset option.
While the OP may not be doing anything "wrong", he is almost definitely doing something unusual, or has deeper issues like malware or malfunctioning hardware.
If the ratio were inverted and most users were experiencing daily crashes from normal use, I would consider myself lucky. That's just not been my experience with Chrome/Firefox.
With 4 GB ram, Chrome will happily give ~2GB to any tab that requests it in a couple of seconds, leaving me with an unresponsive Windows aggressively paging memory to disk, only to give whatever it finds... back to chrome
If a browser tab wants to store 300MB of data in RAM, or wants to throw a shitton of stuff at the DOM, Chrome needs to oblige.
Im affraid tabs taking 2MB(two megabytes for a page with javascript, not 20, not 200, two) like in the good old Opera 12.16 wont come back :(
We may see something similar come out of the Vivaldi project which is headed by folk who led the Opera <= v12 development who know very well what was lost when Opera moved to Chromium based web engine.
Case in point fresh Vivaldi on startup makes 4 connections to Google just to say hi, and will keep sending google delicious pieces of data throughout the day, not to mention hardcoded google DNS in case yours is too slow. How about spamming my local network with chromecast UDP garbage? or enumerating shares on startup? WTF would you even do that?
Ps I use Vivaldi :/.
Personally I still have Opera 12.18 installed on every computer as it still is the most swiss-army-knife browser out there for countless reasons. Most of the webpages can be made to work properly in it by adjusting the site preferences.
One thing I am yet to see any of the new browsers be capable of is complete popup blocking. Opera 12.x excelled at this and a complete blackout of popups is 100% achieveable.
A simple, trivial feature that's in every browser on Earth, except bloody Chrome.
Its been requested pretty much forever and Chrome takes a perverse delight in ignoring the most requested features, because of course they know better than their users.
other examples - multi row tabs, customizable fonts, and actually giving a damn about memory usage.
Chrome is a memory hog and instead of optimizing that, the solution is to kill background tabs. This is very similar to Android's logic - instead of trying to fix rampant 'Android system' and 'Play services' wakelocks which cause massive battery drain, the fix was to forcefully suspend apps via Doze, which of course ignores the real problem entirely.
> This will break the web.
But apparently blogger requires javascript just to render static content.
I've reverted to a plain-HTML layout.
Please turn JavaScript on and reload the page.
DDoS protection by CloudFlare
Ray ID: 326502e238204c96If your backgrounded browser app needs 100% of the CPU, you've made a mistake.
Better IMO to bury the choice deep in settings or something, for power users, if you even offer the choice at all.
Sounds like you could kill two birds with one stone: allow a non-lame web and encourage users to learn what that means. We can't complain about tech illiterate users with one corner of the mouth and then make them decide what goes with the other.
> if you add more text to explain it, most users will not read it
They're not users. They're the blight on the back of users. Why cater to them? Is someone who looks left and right before crossing the street a "power pedestrian", too?
"This tab wants to use a lot of [RAM/CPU/GPU] while it is in the background, is that cool with you?
If you don't know what this means, it's best to select no. Fuck that site anyway for using a lot of resources without making it obvious that it's doing something heavy, or asking first, or explaining what is going on. If they don't like users clicking no or even navigating away from the page, that's their problem. If you read this far, click here to claim your Avid Reader Achievement Trophy."
Not bad for a first draft?
actually they are about 90%+ of users
edit: Usage implies intentionality. Intentionality implies awareness. Not being some super guru, but more awareness than "is text, won't read". Therefore, while the drive to shovel hardware on people, to create needs you then get to fill, did indeed bring all sorts of people who now get called users to the table, I don't consider them such. It's like someone who has a seizure on dance floor is not dancing, or like someone you forced to be somewhere is not "visiting that place". And I know people don't find it rude to just ignore a claim of how something ought to be with "but this is how it is, which is why it can and must be that way", which is why I say what I say. If someone does bad things and won't discuss them, it's absolutely up to the people who are aware and care to act. If you don't understand poetic language unless it's flowery that's your problem. So yes, I stand by what I said, just not by what it might evoke in the minds of some readers.
[1] https://groups.google.com/a/chromium.org/forum/#!msg/blink-d... [2] https://support.google.com/chrome/answer/1184722?hl=en
I have a webaudio side project that works nicely even on the background using serviceWorkers for timing. I'm hoping it will be the same on 56.
They work fine in latest Chrome and kinda work in Firefox. But Edge and mobile browsers? Not a chance.
I'm curious because I have a HTML5 audio web app that works great, except when running on mobile in the background.
When the setInterval was in the main code it would slow down, a lot, when the tab was on background. That made the generated music go slow aswell. With the serviceWorker the clock is rock solid, even when the background app can't keep up, the timing is solid.
So it may work for some cases, but not for all.
[1]: https://www.w3.org/TR/service-workers/#service-worker-lifeti...
The dev team also acknowledges this is a breaking change for the web and considers it an "intervention" according to [3]. This admittedly doesn't mean much, but at least gives some basic standard of procedure that sites can follow to keep impact on a minimum.
Also noteable is this bit from the current discussion: We mitigate this by only throttling timer tasks; other tasks such as loading tasks will continue to run unthrottled.
Sounds to me as if this could mean that IO events are not effected. So sites that currently poll for notifications in the background might work around the throttle but using long polling or web socket push instead.
[1] https://groups.google.com/a/chromium.org/forum/#!topic/blink...
[2] https://docs.google.com/document/d/1vCUeGfr2xzZ67SFt2yZjNeaI...
Whether this implementation affects just timer callbacks or all background processing (eg websocket data events) is a bit ambiguous - this blog post seems to suggest major apps like Slack and Discord will break, but surely they are using websockets and not continuously polling for new data.
I wrote my own script that does this: https://github.com/kahing/bin/blob/master/throttle
Good, if web apps will become less reliant on doing everything in the server, so I will be able to open up multiple tabs without slowing down a computer.
Finally, a reason to move to Chrome! (Currently a Firefox user)
This will be great thing. Right now my Chrome eats about 10% of CPU, mostly Skype, Slack, Calendar... With Opera it is bellow 1% and I get much better battery life.
There should never be a situation where background tab cant even get a 1 second timer running reliably, unless its trying to compute pi at the same time.
This is why browsers really need to focus more on letting web pages be applications. On mobile, you can "add to home screen" for a web page and that's expected behavior. That needs to be forefront on the desktop as well.
I have over half a dozen SSB applications using Epichrome on the Mac, but that requires a level of technical expertise (finding and downloading a third-party program, finding icons to use, knowing that this capability exists in the first place, and so on) that you can't expect from average computer users. (Epichrome is great btw.)
For a lot of the situations that I see complaints about; I wonder if they really should have written traditional thick applications instead of a browser application.
Olivier TilleJanuary 24, 2017 at 8:28 AM
>That shouldn't be a problem as apparently "tabs with audio are always considered foregrounded". Source: https://groups.google.com/a/chromium.org/forum/#!topic/blink...
UnknownJanuary 24, 2017 at 8:53 AM
>And there's your workaround. Loop a 1 second null audio file for as long as you need to (please don't).
Another idea is to look at other Chrome users activity pattern in regards to how often a given URL is kept hidden and revisited to determine how much throttling should be done to it, something like an AdBlock list.
I still want to throttle (or suspend) background tabs, because the laptop gets uncomfortably hot otherwise.
I just can't imagine tons of games that are out there working nicely. New release is estimated to land on 31 January[0], how the hell are people supposed to update their codebases?
Unfortunately, our current implementation throttles WebSockets. Because of this we ARE NOT SHIPPING this intervention in M56.
The current plan is to disable time-budget background timer throttling for the pages with active connection (websocket, webrtc and server-sent events) and to ship in M57 (subject to further feedback). We will keep you updated with the progress.
Starting in KitKat, a batching mechanism was introduced, so that apps which declared that they wanted CPU or screen resources in the future didn't all have separate timers running, but instead became members of a class that wanted similar things.
One of the most effective features of Greenify, a battery-saving app, is to force all apps (or all apps minus a few that you designate) into the batching mechanism.
Mobile browsers are already stopping background pages because otherwise the phone's battery would be drained in hours.
Unless a background page is doing something useful for user, it should not consume any CPU time.
I really don't want any JS to be running in background. This includes WebWorkers and ServiceWorkers.
Say you use up 150ms of CPU time. Chrome isn't going to let another timer fire for 15s. Then, you're late on a whole bunch of work that needs to get done, so the next timer takes 500ms. Chrome then throttles the next timer by 50s. And so on and so forth...
How is this different?
After a timer has executed, its run time is subtracted from the budget.
The budget regenerates with time (at rate of 0.01 seconds per second).
I think that would imply that if in any given second, your timer code runs for <= 10 milliseconds, then you will never run out of budget. Right?
So for things like sending out heartbeat packets to keep connections alive, I'm assuming that doesn't count, because it happens asynchronously (waiting for the response, I mean)? If that's the case, and your 10 milliseconds only applies to running JavaScript on the CPU, then 10 milliseconds seems reasonable to me. It's a background tab, after all, it's disrespectful of your users to abuse their CPU more than that.
As long as you can turn it on and off, no big deal.
If this were implemented then finally I could open 120 tabs in a window for a detailed query (and they're not all loaded, there's zero overhead), then after 11 minutes of reading a few of those tabs, closing the ones I've read and having others load in their place if they weren't already loaded, be left with 87 unopened tabs with which I could close, since I've learned everything there is to know about that subject and I don't feel the need to read the rest anymore: I feel I've found the answer.
As it stands I can become an expert in any subject accessible in a day or two, in twenty minutes - unless, as sometimes happens, Chrome gets in my way. I can do it by opening them in background tabs today - but Chrome will both slow down and also be at high risk of crashing completely, not just in the window I'm in but all windows. Because at the moment even the 99th background tab, which I want to open so as to potentially glance at, actively, fully loads even if I close that window before I ever want to glance at it.
Along the same lines, I strongly feel there needs to be a way (not necessarily the default way) to open private (incognito) windows in a way that opens them privately "Except for crashes" -- meaning that these tabs remain open until I close it, by clicking the X button, not whenever Chrome crashes - which usually happens when it's done using all my memory.
If you fundamentally disagree that there is a distinction between the user actively exiting and you crashing unexpectedly, then you might as well change the Incognito greeting text to "Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs or Chrome crashes unexpectedly".
But that doesn't make much sense. So please make the functionality match what was promised to the user, and keep pages open until the user has closed closed all incognito tabs. Not you.
I feel that these changes would improve people's experiences drastically. Chrome's developers surely care about their users and want to give them the best possible experience, and in addition this would get Google more clicks, more traffic, more ads from Google search results, by letting people open more pages with abandon on a lark, or on some thread they want to explore. By letting people keep more pages and searches open or queued for opening.
For the second point (about keeping incognito tabs on disk until they are actively closed with an X, at which point deleting them) - this also gives their users what they've just been promised. Whereas, at the moment in Incognito stuff just disappears whenever Chrome decides to crash -- which is often, given that at the moment it aggressively eats memory for any tab anyone might want to follow. This substantially increases the cost of exploring the web by opening background tabs. It makes people really weigh whether they want to open a background tab: it adds friction.
The web is about links. I hope Chrome will start letting people follow more of them and not lose their trail if they don't want to keep it in their history. This would be a positive change for all users, but, especially, the heaviest and most thorough users of the web, who load and visit the most pages. Now they could open even more in a browsing session, without having to think about whether they really want to risk opening another tab. (In terms of resources.)
For all of these reasons, I hope Google will implement enqueued tabs. Separately, at the user's option, I hope tabs status will be kept on disk until the last incognito tab is closed manually by the user (at which point it's scrubbed with random data), so that upon a crash it can be re-opened unless the user presses an X to that window. It would improve the experience of using the web for anyone who wanted it and not deprive users of the reading they worked hard to assemble for themselves. And it would increase the velocity with which users could explore the web.
Thank you.
--
[1] Functionality. Right-click a link, click "enqueue", this should be the same as "open in background tab" except the tab is really kind of like a placeholder, just consisting of a URL. It's not a full background tab that opens, gets its window name, etc - instead, it is not loaded until you actually make the tab active.
Right-clicking the tab bar should give you the option (in addition to normal options) "Close all enqueued tabs", leaving just tabs you've fully normally opened.
Example usage: say I'm searching for an article. I can start by doing some obvious Google searches in a few different tabs. I can go through the results and enqueue each one. Then I can go through the first (when it becomes the active tab, it is loaded) and enqueue any links that might lead to what I want. Then I close the now full-fledged tab when I'm done reading and following links, the next tab becomes active (which might have been an enqueued tab in which case it becomes loaded for the first time) and I can keep doing my search. Eventually I've found the page I'm looking for and can close all of the enqueued pages, or perhaps drag the tab into a new window (as you can today) and then close the old window - disappearing all the enqueued pages but also the normal, fully loaded tabs, per the normal behavior closing a window. (An enqueued tab is just a semi-loaded tab, just a URL that never loads until the tab becomes active. If its window or itself is closed in the way you usually close a tab - by right-clicking and clicking "close tab" or by middle-clicking on it, before it was ever the selected tab, then it simply wouldn't have even loaded a single time.)
This is exactly what I do today: except I have to be careful that Chrome doesn't crash while I do it, because it doesn't do it gracefully. I would like to manually specify whether I want the background tab to be actually loaded.
https://groups.google.com/a/chromium.org/d/msg/blink-dev/XRq...
Firefox y u sux so much?
This is a good default; too many websites are built under the assumption that they're the only thing open and they have infinite resources to burn. Granted, I'd like to see more configuration options before this hits primetime, but I think it's going in the right direction to force some discipline on pages if the developers don't code it in (especially since there are events to tell when you've gone background).
"Kill"? Does your desktop stop responding and show a BSOD? How many tabs do you have open when that happens?
I don't know how heavily people use their Chrome but for me, ~50-100 tabs across ~5 windows across 3-4 virtual desktops seems to not hinder my laptop at all. It's very responsive and no crashes. To be honest I've never seen a system getting "kill"ed due to too many tabs.
My usage does not involve many video/audio tabs though. It's mostly lots of text pages and the usual mailboxes etc.
I think browsers should follow a similar paradigm for background tabs as the OS follows for background apps, ie, both have an equal share on resources unless foreground apps start slowing down due to background activity.
It is not yet bullet-proof against a process deciding that it deserves all of your CPU and so much RAM that the disk cache needs to thrash to support it.