Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much memory before it becomes rude?

I'm currently working on a web app, and have been inspired by a couple different apps out there (mainly Cloud9IDE) in how they hold a large majority of their interface in javascript objects. This makes it incredibly easy to add features in the future, and also allows extensibility options in the future.

The question is, at what point does storing data in memory (via javascript) become rude. I'm building a social network (think like Twitter), and essentially I would be storing an object for every "tweet", as well as some more broad objects for interface items.

Are there hard limits forced by browsers on how much memory I can use? Will my website crash if I go over? Or will the entire browser crash? Will it slow down the user? If so, is there a general rule for how much memory will bother the average user?

like image 985
jwegner Avatar asked Feb 08 '12 23:02

jwegner


People also ask

What is a good memory footprint?

So as a rule of thumb I would recommend staying below 150-200 MB of memory.

How much memory can a browser use?

With the 20-tab test, Chrome performed the weakest , eating up 1.8 GB RAM, compared to Firefox at 1.6 GB and Edge at only 1.4 GB. Edge continued to perform the best when I loaded 60 tabs in a single browser window, taking up 2.9 GB of RAM, versus 3.7 GB for Chrome and 3.9 GB for Firefox.

How do I see how much memory a website is using?

Use the Chrome Task Manager as a starting point to your memory issue investigation. The Task Manager is a realtime monitor that tells you how much memory a page is currently using. Press Shift+Esc or go to the Chrome main menu and select More tools > Task manager to open the Task Manager.


1 Answers

Absolutely positively don't use anywhere close to 4 GB of memory. Most people use 32-bit browsers, so the browser couldn't support 4 GB anyway :)

On a more practical note, remember that the more memory you take up, the slower your app will usually run. Today's Intel/AMD (I don't know about ARM) processors access registers about 100 times faster than accessing memory that isn't in cache, so if you use a lot of memory you will cause thrashing, which will slow down your application dramatically.

So, assuming that you want users for your social network, you should try to design your website to work well on as many machines as possible. Millions and millions of people are still using Windows XP machines that are 5+ years old. These machines might have as little as 512 MB of RAM, so if you are using a few hundred megabytes, you can thrash all of memory rather than just processor cache, as the kernel keeps swapping out pages that you want to use. So as a rule of thumb I would recommend staying below 150-200 MB of memory. GMail takes up ~100MB of memory on Chrome for Linux, so I think that keeping up with GMail is a reasonable goal.

Another benefit of keeping memory usage relatively low is that your users can more easily view your site on a smartphone. An iPhone 3GS (there are still a lot of them in use) has only 256 MB of RAM, so staying below 200 MB in your website makes it easier for a smartphone user to load your site without having to kill processes indiscriminately.

like image 199
Adam Mihalcin Avatar answered Oct 04 '22 13:10

Adam Mihalcin