browser memory consumptions & certain websites

Discussion in 'other software & services' started by Sully, Jul 10, 2012.

Thread Status:
Not open for further replies.
  1. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    I am no web code wizard, although that is my current focus.

    I have been doing a lot of research on web coding (htm/php/css/ajax/java/jquery/etc/etc) for a huge project I have to do.

    In my research, I have noticed that my browser is really struggling. Using Chrome. A specific site that seems to effect it is
    http://net.tutsplus.com
    in the php tutorials.

    Now, lets put some history in place first. Years ago (maybe 6 years) I was researching something else (who really knows what, I am always researching ;) ). I was using Opera then on an athlon 2500xp machine (or something of equivilent anyway) with XP Pro installed. The machine had a SATA I hdd and 1gb of I think ddr 400 maybe, or ddr333.

    Anyway, back then I was able to easily open 30 tabs in the browser, and it remained responsive, not consuming, as I recall, much more than 150mb of memory. That was a lot of tabs.

    Today, with a c2d 2.4ghz machine, and 2gb ddr800 (i think, maybe 667?) and a SATA II hdd, with a gtx7900 vga adapter, I am lucky to open 10 tabs and not "feel" it.

    I had a good number of websites open - tutorial pages and man pages, from forums and the likes of php.net. I had perhaps 11 pages open from that link above. Everything was doggy doo doo. Lots of waiting. Click on a tab, wait for display. Watching chromes task manager and windows task manager and process explorer showed every second or two a 30-40% cpu spike for a second or two, and chromes total memory (per each chrome process) was around 450mb. My free memory, out of 2gb was only 143mb (as per windows task manager).

    Physical memory useage right now, with 8 other tabs open in chrome, is a total of 800mb including the OS.

    I thought I might try opera and see. I opened the same tabs in opera from that site listed above, and the total tabs open were around 22. Opera was already consuming over 550mb of memory. It was more responsive than chrome was with 30 tabs open. The site listed above was again consuming a lot of cpu every couple seconds.

    My question then is, for you who know, why does this occur.

    Is the web content now so laden with java (which chrome task manager showed as the primary used amount of memory) that things crawl? I did not see an overabundance of of images, maybe a couple megs worth. Is it ajax and the asynronous comms?

    Just what is it that causes this? If an older computer and an older browser could handle it back then, why can a better computer and a much fatter broadband pipe and supposed better browsers now choke on such things?

    I have had thoughts for a long time now that software developers just assume everyone has ample cpu cycles and memory so they don't "optimize" things as much as they used to have to. Anyone think that is compounding the problem?

    Further, what can be done about this issue? I don't think it is unreasonable to open 30 tabs, each tab really should only have a static web page that shows a tutorial or a forum post or a man page. It is not like there is streaming content or hi-res images to view.

    Any thoughts?

    Sul.
     
  2. RJK3

    RJK3 Registered Member

    Joined:
    Apr 4, 2011
    Posts:
    862
    I can't comment on CPU usage - as you already say, the websites content and code may be very different from what you used to look at. I don't have a great deal of slowdown using Palemoon on multiple tabs once they're loaded (whereas Firefox itself just pauses for seemingly no reason regardless of how many pages are open these days.)

    In terms of memory usage - browsers are designed to utilise more of it on computers that can spare it, which is fine given that pretty much every modern computer has a surplus of memory. You probably already know this so I won't insult your intelligence further...

    Are all webpages and forums necessarily static though? This site used to slow down my netbook quite noticeably compared to others when I was logged in, so presumably the 'session' is more than just cookies.
     
  3. Hungry Man

    Hungry Man Registered Member

    Joined:
    May 11, 2011
    Posts:
    9,146
    Javascript (not Java, which isn't used much anymore) has gotten pretty heavy.

    A heavy webpage back in the day would be: (no scripting, all html buttons and link images)
    http://www2.warnerbros.com/spacejam/movie/jam.htm

    A heavy webpage today is more like:
    http://www.engadget.com/

    The difference should be clear. Spacejam's webpage (thank god it's still alive) is basically html buttons and pictures. Engadget has multiple CSS animations for moving tiles, lots of javascript, tons of images, tons of links including links to external pages (ie: facebook, twitter, plus) and it's got way more images.

    As for optimizing people have *never* done it. You absolutely can optimize for V8 and see massive returns (double digits) but no one really does.

    I think part of that memory is likely script and css caching as well as image caching but mostly the difference between now and then is that the web has just gotten a lot heavier.

    Try an old machine running an old browser and load up these sites - it won't be fast.
     
  4. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    Thanks for responding. This thread is dual purposed I guess - part about which browser "feels" many tabs open and part why certain pages cause sluggishness in the browser.

    I have no doubt that todays web content is much larger than year prior, but I wonder why, once the page is loaded, cpu useage is so high, and memory consumption is so high. Looking at the content of a page, it is mostly text and color, not much data there. If you include all the images, which are normally very small insize, even for many tabs it should not about to half a gig of info to store in memory. So I wonder, why the cpu use, and why so much memory to store a static web page - not meaning static that the data is always the same for everyone, after all there are usually adverts in most pages, but static in the fact that all the content is already in cache, and consumes in reality a minimal amount of space. I would assume the whole 5mb worth of data would just sit there, not consuming much.

    Is there a way to gather the total contents of the cache per page/tab, and see what physically resides in the cache? One could then look at a certain page, see there is only Xmb of physical data there, and then see a 10x amount of memory useage and perhaps gain some insight.

    Sul.
     
  5. BrandiCandi

    BrandiCandi Guest

    Flash can use a crapload of cpu, don't know if that's the issue.

    As for gathering the total contents before it loads, I'm not sure you can do that. Some of the webpage contents might compile on the fly, so I don't think you can capture it before it compiles. I don't really know though.

    I suppose you could use NoScripts or some similar add-on and block everything, which will show you a list of how many scripts are running on a page. You could watch a system monitor simultaneously and allow one script at a time to see how much memory is getting used.

    The way I understand it is javascripts execute in your browser. So maybe your browser is busy obediently executing all the scripts after it's loaded?
     
  6. RJK3

    RJK3 Registered Member

    Joined:
    Apr 4, 2011
    Posts:
    862
    The simplest way I can think of is to make a separate Sandbox without direct disk access to the browser cache. Have the browser load to a blank page, and then compare memory usage (working set, commit, etc) to when you go to a website. Then you can assume that anything in the cache within that Sandbox is from that particular page.

    Firefox normally lets me drag an item from the cache into the browser in order to view it, i.e. each extensionless file appears to be discreet content of a sort (image, htm, etc).
     
  7. crofttk

    crofttk Registered Member

    Joined:
    May 15, 2004
    Posts:
    1,979
    Location:
    Eastern PA, USA
    Sully:

    You made no explicit mention of security setup. Are the AV/FW/etc provisions the same in both the old and new case so we know that part of the comparison is apples to apples?
     
  8. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    Well, I did use Avira back then. It was a LOT lighter back then than it is today. The browsers of course are no lighter, but back then I was using Opera (whatever version that was roughly 6 years ago) and today I am Chrome and the latest Opera.

    Currently I have no AV and no FW, actually nothing really, not even sandboxed right now. Just a low IL forced on Chrome and the downloads directory is forced low IL and forced into SBIE.

    Back then, other than using Avira, I might have been using Outpost Pro firewall, but I was most likely not using any of the plugins and had 2 simple rules as templates - allow or deny.

    I would say, that since I am not comparing how "fast" the data gets to me, but what is happening once it has arrived, that it is perhaps not important on what I was running security tool wise then vs. now. The real time protection of Avira then would have "touched" everthing coming in but once it arrived, it should have been loaded into memory and not "touched" aftwards, so no "scanning" would have happened. As well, I could understand the importance if I was using something NOW that I was not THEN as NOW is SLOW and THEN was FAST. But since now I use even less than I did then, yet it appears in general things are slower/larger/whatever than they were, I don't see how it would impact anything.

    But then, I am only a babe in web related things, so maybe it would make a difference.

    Sul.
     
  9. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    Hmm. That makes sense then why the chrome task manager showed almost all of the memory consumption was in the JS memory segment.

    Oh, I have. It is not pretty for certain, but if you try an old machine (think 1.8ghz Pentium with sdram 133, but with a good NIC) with a new browser, it is so very painful. Switch to an old browser (old opera v6.x) and it becomes fiairly snappy on many pages, presumeably those that don't use much client-side scripting.

    AFAIK there is no flash involved. There might be in an ad I suppose, but I don't really recall anything like that standing out. It certainly wasn't a main feature. I think some sites had a flash box ready, if you wanted to click the "play" icon. Maybe the flash dependencies are loaded for the player and require scads of memory, just to wait for the streaming content?

    I did not mean gathering the content before it loads, but rather as RJK3 eludes to, after it has loaded to see, within the cache, exactly how many "physical" files exist and how big they are.

    Thanks for the replies..

    Sul.
     
  10. RJK3

    RJK3 Registered Member

    Joined:
    Apr 4, 2011
    Posts:
    862
    If you're not using Sandboxie, another way I suppose would be to use a portable browser. Can wipe the cache after each time.
     
  11. JRViejo

    JRViejo Super Moderator

    Joined:
    Jul 9, 2008
    Posts:
    98,095
    Location:
    U.S.A.
  12. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    I have SBIE installed, just not forcing it on my browser for the last year or so (in a long term test). I can indeed do exactly what you suggest, just haven't... yet.

    Yes, I used this, and enabled each of the memory specific columns. For example, this page open lists:
    Memory: 34,600k
    Java: 21229k (14171k live)
    SQLite: na
    CSS Cache: 5.5k (5.5k live)
    Script Cache: 445k (0k live)
    Image Cache: 841k (619k live)

    When I had 30 tabs open, looking at this showed a lot of memory being consumed in the JavaScript field, much of it being live. Why would it remain live? Why would it continually grow and consume cpu cycles? What is in a tutorial or forum or man page that requires such constant script use then?

    It is also interesting to note, that in chrome, sometimes (like right now) there are 4 tabs listed in the same process - or at least it appears that way. They consume, together
    Memory: 156,000k
    Java: 94177k (91377k live)
    CSS: 337k (327k live)
    Script: 62k (0k live)
    Image: 5189k (4799k live)

    Why would mulitple tabs be owned by one tabs process? why would these pages, which total only 5000k of images and very little CSS sit there, doing nothing, but still use periodic cpu cycles.

    There must be something I am missing here with client side browser scripting. It must be that when a script calls a resource, it loads into memory and then stays resident until the page/session is destroyed. So then each script that is sent on a request consumes X number of resources (depending on the functions/methods within the script), each adding up to overall memory consumption.

    Anybody know if that is indeed how it works? Bear in mind I am not trying to fix this, just really wishing to understand the "why" :)

    Sul.

    EDIT: it is interesting to note, that visiting a page that contains nothing more than a small banner and a few input tags, chrome lists the java memory as 9999k (5555k live) and the entire process uses 16000k. I wonder what am I missing here? Is this simply the chrome engine itself consuming memory to render the pages?
     
  13. Hungry Man

    Hungry Man Registered Member

    Joined:
    May 11, 2011
    Posts:
    9,146
    If I have 5 wilderssecurity.com tabs open they'll all share one renderer process and one tab process.

    Extensions running on the page could also be added to this, which is why a blank page may show Javascript memory.

    Javascript remains live because that is primarily what Javascript is for - interaction. So 'onmouseclick' doesn't just get called and then released/ destructed it needs to wait for the mouse click.
     
  14. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    Hmm. I have minimal extensions right now, just sessions and gmail checker thingee.

    Why is it that tabs share one process? I thought that was the chrome way, to keep each tab separate.

    I see about the java, not so much for constructing the page, but for interaction. I have done some java, but not browser scripting so much as stand alone type applications for different reasons, and not an awful lot to begin with. Makes sense I guess, but that sure seems like a lot of code to wait for me to click the next/previous button or some ads. Most of the stuff I have had open really only allows navigation, no input forms really. I can write a whole lot of code in different languages that do a lot more that don't take up near that amount of memory. Maybe it should not be called a "script language" lol.

    Sul.
     
  15. JRViejo

    JRViejo Super Moderator

    Joined:
    Jul 9, 2008
    Posts:
    98,095
    Location:
    U.S.A.
    Sully, perhaps you know this already, yet there is an extension called Web Developer (also available for Firefox) that could be useful in viewing JavaScript, CSS, HTML, Image Information, etc., in trying to determine Web page content. Just FYI.
     
  16. Hungry Man

    Hungry Man Registered Member

    Joined:
    May 11, 2011
    Posts:
    9,146
    Imagine uploading a file to wilders. It opens up that popup and you upload and then it needs to interact with the other Wilders tab. That's why they share a process.

    There are also cases where Chrome will have two separate websites within the same renderer process if you have too many tabs open - Chrome then deals with this by having the renderer process internally segregate the information.

    As for the Javascript you'll have 'onmouseover()' and then your entire onmouseover function of

    void onmouseover(){
    int x = parseint(userinput);
    do {setblah(x)}
    while x = blah blah blah

    if(x > y)
    access.dom.element.here

    }

    (my sloppy pseudo code is embarrassing lol)

    and suddenly you've got a whole page of javascript just waiting for you to mouse over a button

    I also think that newer browsers do, as you say, assume a level of hardware and therefor they trade resources for performance. I know there's a firefox plugin type thing that will swap out your RAM usage aggressively and perform garbage control but at the cost of CPU usage. Not a perfect example, but the point is that you can get RAM usage down a ton it's just not built that way because most people have the RAM.
     
  17. Sully

    Sully Registered Member

    Joined:
    Dec 23, 2005
    Posts:
    3,719
    Thank you. I did not know of that. Is it similar to the tool that chrome has built-in?

    Sul.
     
  18. JRViejo

    JRViejo Super Moderator

    Joined:
    Jul 9, 2008
    Posts:
    98,095
    Location:
    U.S.A.
    Sully, I find that Web Developer has more individual features than the built-in Developer Tools, which reminds me of Firebug, a Firefox add-on.
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.