Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Resource consuming inside and outside differs significantly

  • 1 பதிலளி
  • 1 இந்த பிரச்சனை உள்ளது
  • 9 views
  • Last reply by Shashank Shekhar

I investigated the immediate cause Firefox hangs or responses with long delay. Mostly, the immediate cause is that Firefox writes to disk a huge amount of bytes. Disk operations are slow, block calling thread (at least), and consume battery charge intensively. All this is of great importance to portable devices equipped by HDD (my case). The second bottleneck is memory page thrashing caused by excessive memory consuming and a lot of unloaded memory pages. When these two factors occur on the same disk, this doubles or triples disk response time, hanging a lot of processes in the system (including the firefox processes). This effect I observe every time when running Firefox longer one hour intensively web-surfing. I used ProcessHacker to measure memory consuming, disk and network operations in bytes. Then I compared these metrics with Firefox reports "about:performance", "about:cache" and "about:memory". This comparison exemplified that resource consuming from inside and outside looks very different. The second conclusion is that network usage ten or more times lower than disk usage, which should not be even if content is unpacked and saved. And the main question is why disk usage are close to memory consuming. This speaks in favor of the fact that disk usage is inefficient and surplus: most data can be stored in memory. Let's consider the attached screenshots. The first part of screenshot 'Firefox external metrics@77.0.1' consists of two parts with ProcessHacker window and contains the following external metrics of the parent firefox process:

  • Working set = 2 GB (summed over children processes)
  • Virtual size = 3.25 GB
  • Network total bytes = 287.1 MB
  • Disk total bytes = 3.02 GB
  • Disk write bytes = 2.48 GB
  • Disk read bytes = 551.23 MB

The firefox process structure is in the second part of that screenshot. The same observation -- excessive resource consuming exemplified by the same metrics. To estimate total memory consuming, I closed Firefox and compared memory usage by "System information" (ProcessHacker's tool): the commit charge level decreased by 4.2 GB and the physical memory level decreased by 2.7 GB. This means that 1.5 GB memory pages are in the paging file, i.e. stored on the disk! In comparison with Windows 7 memory consuming, we see 748 MB versus 2.7 GB in physical memory. Does Firefox indeed execute so many tasks and provide so many functions and deliver so much value as Windows 7 Pro operating system? The comparison Firefox versus MS Word 2010 with 20 opened documents (about 200 MB RAM consumed) leads to the same observation: the former has much higher resource consuming per functionality/value.

However, Firefox's "about:cache" and "about:performance" don't report such resource consuming: see the according screenshots. I summed memory usage by web pages enumerated in "about:performance": all 16 loaded web pages consumed 522 MB in total instead of 2.7GB physical memory and 4.2 GB virtual memory. What does Firefox really do?! This is why I suppose that Firefox executes hidden extraneous tasks. To those who would like to analyze Firefox's memory report in detail, I saved and published it: https://yadi.sk/d/S9Z4AERdS8LHWg

My point is that disk I/O operations should be decreased significantly in order to prevent Firefox from hanging and to decrease response time on user actions. There are several measures to do it. First, stop using RAM in uncontrolled and ineffective manner as we saw it even on 16 web pages. This means estimating and measuring memory overhead per content byte, per user-level function and per delivered value. Second, stop using disk-based databases, use in-memory databases instead. Third, use effective data structures and data architecture. To prevent memory page unloading, use OS API to disallow unloading of desired memory pages using proper attribute. Yes, if your data/programming languages do not satisfy these critical requirements, use another one. If your data/programming technology do not satisfy these critical requirements, just change it. If your values interfere with this approach, then make the browser’s mission to be the main value -- visualizing hypertext to the user quickly, cheaply, conveniently and effectively. All other values around it have lower priority, remember! No one need safety and transparency and so on if the browser hangs with other process in the system or web page loads more than 0.5 second on a real device. This means you should not suppose the modern or superpower device -- you should suppose any device with one CPU of 1.5 GHz and 2 GB of RAM. These resources are enough to display even 100 pages of 1 MB each in size, obliviously. Just because 1920x1600 = 3072000 bytes (one byte per pixel), i.e. about 3 MB per screen image. The main thing the browser do is it transforms 1 MB of input content into 3 MB image of output. Five or eight GB of RAM is too excessive to this operation, isn't it?

I investigated the immediate cause Firefox hangs or responses with long delay. Mostly, the immediate cause is that Firefox writes to disk a huge amount of bytes. Disk operations are slow, block calling thread (at least), and consume battery charge intensively. All this is of great importance to portable devices equipped by HDD (my case). The second bottleneck is memory page thrashing caused by excessive memory consuming and a lot of unloaded memory pages. When these two factors occur on the same disk, this doubles or triples disk response time, hanging a lot of processes in the system (including the firefox processes). This effect I observe every time when running Firefox longer one hour intensively web-surfing. I used ProcessHacker to measure memory consuming, disk and network operations in bytes. Then I compared these metrics with Firefox reports "about:performance", "about:cache" and "about:memory". This comparison exemplified that resource consuming from inside and outside looks very different. The second conclusion is that network usage ten or more times lower than disk usage, which should not be even if content is unpacked and saved. And the main question is why disk usage are close to memory consuming. This speaks in favor of the fact that disk usage is inefficient and surplus: most data can be stored in memory. Let's consider the attached screenshots. The first part of screenshot 'Firefox external metrics@77.0.1' consists of two parts with ProcessHacker window and contains the following external metrics of the parent firefox process: * Working set = 2 GB (summed over children processes) * Virtual size = 3.25 GB * Network total bytes = 287.1 MB * Disk total bytes = 3.02 GB * Disk write bytes = 2.48 GB * Disk read bytes = 551.23 MB The firefox process structure is in the second part of that screenshot. The same observation -- excessive resource consuming exemplified by the same metrics. To estimate total memory consuming, I closed Firefox and compared memory usage by "System information" (ProcessHacker's tool): the commit charge level decreased by 4.2 GB and the physical memory level decreased by 2.7 GB. This means that 1.5 GB memory pages are in the paging file, i.e. stored on the disk! In comparison with Windows 7 memory consuming, we see 748 MB versus 2.7 GB in physical memory. Does Firefox indeed execute so many tasks and provide so many functions and deliver so much value as Windows 7 Pro operating system? The comparison Firefox versus MS Word 2010 with 20 opened documents (about 200 MB RAM consumed) leads to the same observation: the former has much higher resource consuming per functionality/value. However, Firefox's "about:cache" and "about:performance" don't report such resource consuming: see the according screenshots. I summed memory usage by web pages enumerated in "about:performance": all 16 loaded web pages consumed 522 MB in total instead of 2.7GB physical memory and 4.2 GB virtual memory. What does Firefox really do?! This is why I suppose that Firefox executes hidden extraneous tasks. To those who would like to analyze Firefox's memory report in detail, I saved and published it: https://yadi.sk/d/S9Z4AERdS8LHWg My point is that disk I/O operations should be decreased significantly in order to prevent Firefox from hanging and to decrease response time on user actions. There are several measures to do it. First, stop using RAM in uncontrolled and ineffective manner as we saw it even on 16 web pages. This means estimating and measuring memory overhead per content byte, per user-level function and per delivered value. Second, stop using disk-based databases, use in-memory databases instead. Third, use effective data structures and data architecture. To prevent memory page unloading, use OS API to disallow unloading of desired memory pages using proper attribute. Yes, if your data/programming languages do not satisfy these critical requirements, use another one. If your data/programming technology do not satisfy these critical requirements, just change it. If your values interfere with this approach, then make the browser’s mission to be the main value -- visualizing hypertext to the user quickly, cheaply, conveniently and effectively. All other values around it have lower priority, remember! No one need safety and transparency and so on if the browser hangs with other process in the system or web page loads more than 0.5 second on a real device. This means you should not suppose the modern or superpower device -- you should suppose any device with one CPU of 1.5 GHz and 2 GB of RAM. These resources are enough to display even 100 pages of 1 MB each in size, obliviously. Just because 1920x1600 = 3072000 bytes (one byte per pixel), i.e. about 3 MB per screen image. The main thing the browser do is it transforms 1 MB of input content into 3 MB image of output. Five or eight GB of RAM is too excessive to this operation, isn't it?
Attached screenshots

All Replies (1)

Hello Aleksey F., You can submit feature requests at:

Firefox Input https://qsurvey.mozilla.com/s3/FirefoxInput/

And there are also contact links here:

Contact https://www.mozilla.org/en-US/contact/