Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Save our cheap entry-level SSDs or old HDD from destruction by by spacing out the intervals of session store ! #4

Open
trimechee opened this issue Jan 19, 2025 · 0 comments

Comments

@trimechee
Copy link

Hi, I read scary articles about testing that chrome and firefox could consume up to 30GB of data per day even while remaining inactive because of the session store which saves data every second or tenth of a second even if the web browser is inactive!

even if firefox and maybe chrome have taken measures to reduce the data consumed by the session store, for example the session store saves less data on the hard drive if the browser remains inactive for a while (I saw that myself in the firefox flags), session store remains the danger for our cheap ssd or old hdd, I completely deactivated session store in firefox and I had no problem, session store is possibly used when we write an email and the computer stops abruptly, it is used to save this unsaved email but for me if I use the browser just to watch streaming videos session store is not useful, and even the email I can write it in word and copy paste it into an email message so session store is dangerous and not important for me and surely for millions of people and wastes ecological resources, in any case if we can use a specific browser just to watch streaming videos by disabling session store,

to avoid any possible problem, in firefox, I left session store active but I increased the session store backup interval to preserve my old hdd and I haven't had any bug problems for years:

about:config
browser.sessionstore.interval 2147483647

but in Chromium based browsers, it's a nightmare, I tried almost everything, nothing worked to disable session store or space the session store backup intervals:

use incognito mode
edge://flags/
Storage Access API
Web Storage API

--incognito
--disable-session-storage command-line
--disable-local-storage

--disable-restore-session-state
--kiosk --incognito some.web.site
--hide-crash-restore-bubble
--disable-session-crashed-bubble
--noerrdialogs --disable-infobars --disable-session-crashed-bubble --no-first-run --no-default-browser-check --disable-restore-session-state

we hope please , if technically possible and if doesn't need too complex researsh, that the great Chromium-for-windows-7 can add an option to increase the session store backup intervals so that session store consumes less data or disable completely session store , to fix this major problem of heavy session store, thank you!

GREAT NEWS !

Mr bbt-dev suggest this solution and it seems Thorium browser has succeded to implement this feature recently ! :

he said : "In brief, the solution could be rather simple: allow to easily change the path to cache folder.
If Thorium will write the cache to the dedicated disk - this will prevent consuming SSD writing resource. And this allow to easily exclude from backups the browser cache, but keep user profile, plugins etc."

Alex313031/thorium#860

-There are 2 problems with chromium (and also firefox) caching temporary files to the disk:

Described in the opened "Alex313031/thorium#61" issue
During regular backups to external disk the huge cache backups also just because it is situated in user profile folder (and during bulk directories backup it is not convenient to introduce excluding paths).
The solution could be rather simple: allow to easily change the path to cache folder.
If Thorium will write the cache to the dedicated disk - this will prevent consuming SSD writing resource, and could easily exclude cache from backups.
The optimal way would be to store cache to a separate second quite medium-performance physical disk, thus the main SSD resource will not be consumed by writing and then deleting the huge amount of cache during browsing. Less favorable solution would be to dedicate a logical disk on the main SSD to write cache, so the same sectors will be consumed but not on the main "C" disk.

I found an article describing how to change the Chrome cache location either by adding '--disk-cache-dir="F:\chrome"' to the browser icon properties or by using "mklink/D" for setting the redirection at the Windows level (thus mklink/D "C:\Users\user\AppData\Local\Google\Chrome\User Data\Default\Cache" "E:\ChromeDownload\Cache" will redirect all files that would be saved in cache folder to the folder at E: drive).
But I am not sure whether these solutions are good and whether they will work for Thorium in the future versions.

So, the best way would be just to have a setting in the Thorium menu that can easily change the folder with cache. The solution would be quite easy to implement."

  • @ bbt-dev I could add a flag with a little text box where you can type or copy/paste a path to specify for the cache folder.

UPDATE: Added this and some other to the TODO.md for next releaes > Alex313031/thorium@24dcb9f

Alex313031/thorium@24dcb9f

end


some more informations about this subject :

i discover this article of 2016, this problems seems to affect also chromium browsers, it wil be great to save our hard disk and battery to add an option to disable session restore or increase session store intervals, we can do that with firefox but we can't do this with chrome browser, i have made search, i found solution but is complicated , may be it can help, please add option to disable completely session restore, many don't need this feature, we just use browser to watch some videos.....

Thank you in advance !

"Firefox (& Chrome) are eating our SSD's?!"
"Chrome writing to disk every 15 secs"
"Heavy SSD Writes Firefox is eating your SSD"

"Firefox and Chrome can shorten SSD lifetime
September 26, 2016

Firefox and Chrome have been found to continuously write so much data that it might affect the durability of SSDs. Both browsers write an incredible amount of data to disk, even when idle.

firefox-with-32gb-written-in-a-single-day

This was discovered by researcher Sergei Bobik who used the software SSDLife to monitor how much data was read and written on his system. He found both browsers write a lot of data as they continuously make a backup of themselves"

https://myce.wiki/news/firefox-chrome-can-shorten-ssd-lifetime-80534/

https://forums.linuxmint.com/viewtopic.php?t=235651

https://www.servethehome.com/firefox-is-eating-your-ssd-here-is-how-to-fix-it/

"reduced to using Chrome, below is what is going on inside Firefox, it says Chrome does the same thing. I dont need this garbage of Chrome writing the whole page to my micro SD every 15 seconds.
Has anybody found, useing a work around for Chrome, when I looked on the net I could not find anything about Chrome, it was all FF."

"by Nominal Animal
Before switching to a laptop with a really, really fast SSD, I used to keep my active browser profiles on a ram disk (tmpfs).

Essentially, when inactive, your Firefox profile can be stored in a tarball (~/.mozilla/firefox/profilename.default.tar). When active, the contents of the tarball are extracted to a temporary directory on a tmpfs mount (ramdisk), with the ~/.mozilla/firefox/profilename.default pointing to that directory. The only real limitation of this approach is that you'll want to set the maximum cache size to something small; I happily used 0, 32 and 64 megabytes for years. (The no-cache one I used on a 2009 Acer Aspire One A110L minilaptop. It still works fine for casual web browsing.)

There are two approaches to maintaining such Firefox profiles.

First approach is to construct it at login, and deconstruct/repack it at logout. This is managed via a session manager script, and varies slightly between session managers. (I tried to get the necessary hooks for doing this in a transparent, safe manner to GDM, but got fed up with the lack of interest, and switched to LightDM.) The downside is that the profile is in memory even when you don't have a browser open, and if you keep yourself logged in all the time, the tarball version of the profile never gets updated.

Second approach is to customize or interpose /usr/bin/firefox (or /usr/bin/firefox-esr). It is a launcher shell script for Firefox. In it, the exec $MOZ_LIBDIR/$MOZ_APP_NAME "$@" causes the script to replace itself with the actual Firefox binary. If you edit the script, or use your own copy of the script, with the exec removed, the shell will remain in memory while the browser is still running. (In this case, I recommend using dash as the shell, if possible, for minimal resource use.) Before running the browser binary proper, the scriptlet checks if the session symlink points to a valid directory. If not, it sets it up. After the browser binary exits, the script tests if there are no more instances left (ps -o pid= -C firefox or ps -o pid= -C firefox-esr), and if not, re-tars the profile, and removes the temporary profile directory. (I preferred to use sync to ensure the data hits the disk, and notify-send to pop up a notification whenever the profile was safely stored on disk. That way, after making a number of new bookmarks or such, all I needed to do was to close and reopen the browser windows, to be sure they were safely stored on disk.)

For further information, search for firefox profile tmpfs and/or firefox profile ram with your preferred web search engine.
Top

Gee wiss nominal animal, thats a long answer. I was asking about chrome. Go to 'firefox 55 crashing' to see what the experts say to do if you are using a solid drive.

oldchap wrote:
I was asking about chrome.
The approach I used with Firefox years ago works fine for chrome, too."

https://forum.odroid.com/viewtopic.php?t=29810

" It says

"Chrome seems to generate the same operations as well

Early experiments show a similar behavior for Chrome, which also generates around 1GB per hour, rounding up to around 24GB per day."

"Those [SSD] drives can be rated for about 20GB of writes per day and Firefox [or Chrome] alone might be using more than half of that," Bobik warns users using SSD drives.

"Adjust This Setting Before Firefox Wears Down Your SSD Drive Google Chrome seems to exhibit the same behavior"

https://news.softpedia.com/news/adjust-this-setting-before-firefox-wears-off-your-ssd-drive-508665.shtml

https://forums.servethehome.com/index.php?threads/firefox-is-chewing-through-your-nand.11346/page-2#post-108407

Solution :

take inspiration from brave browser which is open source and apparently doesn't have this kind of disk ssd problem

https://community.brave.com/t/a-geeky-noob-tells-you-why-he-uses-brave-browser/102876

"It might seem stupid. But this browser doesn’t scan my whole hard drive right? Chrome’s “Software Reporter Tool” does that. It scans and tests every .exe file.

And, this browser doesn’t keep writing data onto my hard drive when idle, right? Firefox does that all the time. Keep Firefox open for 24 hrs and it will write more than 10GB of data. And I don’t know how to stop Firefox from doing that.
And I love to keep browsers open all the time. So these two problems are really annoying. My last cheap SSD broke sooner because of this?""

"here what i found, some people said this not operational and bug, some said it works.....

"Someone has suggested just running Chrome in Incognito mode to get around the problem If you are running in full screen mode and redirecting to a specific page that shouldn't be noticeable. I know that's a bit of a work around.

Open chrome \ Default \ Preference, and change the value to

"exit_type": "none",

"exited_cleanly": true,

Save the file, and put him to attribute "read only". Tested on various versions of the Chrome browser

--disable-session-crashed-bubble

chrome.exe --kiosk --disable-session-crashed-bubble "http://example.com/"

https://superuser.com/questions/461035/disable-google-chrome-session-restore-functionality

https://bugs.chromium.org/p/chromium/issues/detail?id=445256#c17

https://superuser.com/questions/33548/starting-google-chrome-in-application-mode

https://superuser.com/questions/1640618/how-to-disable-permanently-the-chromium-popup-after-crash-or-hard-boot/1643107#1643107

https://superuser.com/questions/237608/how-to-hide-chrome-warning-after-crash

"I see some inconveniences in the solutions provided:

--incognito switch removes cache, what is pretty bad in most circumstances.

(Copy-pasting chrome help )

Google Chrome has hundreds of undocumented command-line flags that are added and removed at the whim of the developers.

--disable-session-crashed-bubble depends of which version of chrome are you using, the most actual version v39 doesn't have this setting allowed.

The solution I did was to alter the user profile and overwrite the crash status to a normal close status, It's a simple hack that works perfect.

This is the script I run in kiosk-mode in a chrome-only session under Ubuntu 12.04 and 14.04

#!/bin/sh
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/google-chrome/Default/Preferences
sed -i 's/"exit_type": "Crashed"/"exit_type": "None"/' ~/.config/google-chrome/Default/Preferences
google-chrome --kiosk "http://some_url"
It simply finds and replace the string

"exited_cleanly":false
exit_type": "Crashed"
with

"exited_cleanly": true
"exit_type": "None"
So, no matter how chrome has closed. It will always think it has closed gracefully. (Tested in many chrome versions)

quote : "This finally worked for me, and it's pretty simple:

Shut down Chromium gracefully
Change the "Change content" permissions of ~/.config/chromium/Default/Preferences to "Nobody"
That will lock the state of two variables, regardless of how Chromium was shut down:

"exit_type": "Normal"
"exited_cleanly": true
Of course, only do that after you're done setting preferences"

"Finally something that seems to work and ignore the crash (caused by powering the pi instead of a shutdown/restart).

The --app= seems to do the trick from the pi autostart file.

chromium-browser --start-fullscreen --kiosk --app=http://mumti.org/?ch=MUMTI&cat=SLOWTV
--app mentioned here Starting Google Chrome in application mode

One of my previous failed attempts was using sed from the autostart to modify Preferences and "Local State". I have no idea why it did not work on /home/pi/

The last successful solution was https://superuser.com/a/1643107/690627 although this brute force worked I hated it because
"

https://superuser.com/questions/237608/how-to-hide-chrome-warning-after-crash

https://superuser.com/questions/1640618/how-to-disable-permanently-the-chromium-popup-after-crash-or-hard-boot/1643107#1643107

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant