Draft: Run Browser in Ram

interpretive language scripts


Moderator: Forum moderators

Post Reply
s243a
Posts: 501
Joined: Mon Dec 09, 2019 7:29 pm
Has thanked: 90 times
Been thanked: 37 times

Draft: Run Browser in Ram

Post 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:

User avatar
amethyst
Posts: 2419
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 506 times

Re: Draft: Run Browser in Ram

Post 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.

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Draft: Run Browser in Ram

Post 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.

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: Draft: Run Browser in Ram

Post 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. ;)

User avatar
amethyst
Posts: 2419
Joined: Tue Dec 22, 2020 6:35 am
Has thanked: 57 times
Been thanked: 506 times

Re: Draft: Run Browser in Ram

Post by amethyst »

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

Post Reply

Return to “Scripts”