Page 1 of 1

Draft: Run Browser in Ram

Posted: Sat Apr 17, 2021 2:07 am
by s243a

Facebook, is getting to a level of bloat that in my opinion running a portable browser over USB 2.0 is becoming at times unusable. If one is running puppy in usbflash mode then the performance may still be acceptable because at least the changes will be in RAM but in the near future even this may be too slow when running puppy on USB 2.0 devices because the save file its self is not in ram and slow IO will be used to transfer the files too and from ram as needed.

Ideally, on a USB 2.0 system we want to minimize IO usage. To do this we will use both compression and ram. If I compression my iron32 folder the uncompressed folder is 3.577 times the compressed sfs (123MB). In this case -xz compression was used. Even for old system this sfs file could be copied to ram without using a large fraction of ones ram. However, an acceptable alternative is to only keep the changes to in ram.

If one copies the sfs file to ram then the standard puppy options "udba=reval,diropq=w" will minimize the amount of files that propagate up to the changes folder. However, if one only has the changes in ram then one may want to omit these options so more files from the lower layer get propagated into ram.

In my draft script I haven't implemented this distinction yet and the above standard options are not included in my script but these options will be included in future scripts. In the current script I copy both the sfs file and profile folder to ram prior to doing my aufs mount. I will later add options to customize this behavior.

The big thing not implemented yet is cleanup, which will include removing things from ram when one exits or when the browser crashes. There will be configuration options to let someone get prompted prior to removing the stuff from ram (and unmouting) and also a configuration option to prompt prior to undating the configuration folder.

Here is the preliminary script. As noted, there are a bunch of things that haven't been implemented yet but it works:


Re: Draft: Run Browser in Ram

Posted: Sat Apr 17, 2021 9:40 am
by amethyst

Just a note - All my sfs files are gzip compressed at 4 K block size. Makes compressing and decompressing faster. If you have enough RAM your application sfs's can be loaded as additional drives like bdrv, etc. (need some changes to initrd) and copied to RAM for faster accessing. I don't use a savefile but save changes to an adrv which of course is loaded with the puppy files at startup and copied to RAM.


Re: Draft: Run Browser in Ram

Posted: Sat Apr 17, 2021 9:27 pm
by williams2

I also use an adrv sfs file, not a save file.

My adrv does not have Firefox installed at all.

My firefox-start script looks like this (stripped down to basics)

Code: Select all

#!/bin/sh
rm -rf /tmp/firefox
rm -rf /root/.mozilla
rm -rf /root/.cache/mozilla/
tar -C /tmp -xf /mnt/home/PUP1/firefox.tar.gz
tar -C /root -xf /mnt/home/PUP1/firefoxcfg.tar.gz
export LD_LIBRARY_PATH=/usr/lib/apulse:$LD_LIBRARY_PATH
exec /opt/firefox/firefox file:///root/.links/bookmarks.html

First, it removes all traces of Firefox from the file system. Anything that was in there from the last time I used Firefox is gone.
Then it unzips my clean firefox, which is exactly what was there when I last explicitly saved it.
firefox.tar.gz is the firefox program.
firefoxcfg.tar.gz is the configuration files.
Then it starts Firefox.

Everytime I start Firefox, it is clean and pristine.

My script does other things, which I left out.
It redirects error messages,
it shows a yaf-splash splash screen window,
it displays a few messages,
it overwrites my resolv.conf file with what I want to put in it.

If I want to update Firefox,
I start Firefox to get a clean copy newly unzipped.
I click Help, About in the menu and click the update button.
I restart Firefox to install the updates.
I immediately tar the new version, like this:

Code: Select all

cd /tmp/
rm -f firefox.tar.gz
tar czf firefox.tar.gz firefox/ || exit
cp -abi firefox.tar.gz /mnt/home/PUP1/

The next time I start Firefox (and everytime I start Firefox), it will be the latest version, clean and pristine.

I am running Firefox version 87.0, at the moment.


Re: Draft: Run Browser in Ram

Posted: Tue Apr 20, 2021 9:48 am
by mikewalsh

@s243a / @amethyst / @williams2 :-

Great stuff, guys. All of this goes to show that the desire to experiment, script & improve stuff in general is still alive & kicking in Puppyland. I'm really pleased to see it..!

Of course, much of this is only really possible in Linux (and especially a distro like Puppy, where it's so quick'n'easy to back things up) prior to "messing-around". You try doing this kind of personalized stuff over on the Dark Side; I suppose it MAY be possible (I haven't used it for several years).......but I can't imagine you would get the same sense of achievement out of it.

(*shrug*)

Mike. ;)


Re: Draft: Run Browser in Ram

Posted: Tue Apr 20, 2021 10:29 am
by amethyst

I've written a few batch scripts for my Windows system (with care). Much better to mess about with Puppy though, safer.