| by Arround The Web | No comments

How to Place the Brave Browser’s Cache in RAM

Your web browser cache stores images, HTML, and JavaScript from the sites that you visit in a local cache. This allows for much faster page loading and less bandwidth usage. Basically, once an asset is saved to the cache, it is reread locally unless there has been some sort of change remotely.

What is Tmpfs

Tmpfs is a temporary filesystem that is made from the system’s available RAM. Tmpfs can be mounted anywhere on the system to provide a fast, non-persistent storage. Arch uses tmpfs by default at “/tmp”, “/var/lock”, and “/var/run”. Anything written to tmpfs never goes to the disk and it is flushed when the system powers off.

Try Using Brave

Brave is a newer Open Source browser based on chromium. It is anti-tracking and privacy oriented. It can connect to tor with no extra configuration. It is available on all platforms and, being based on chromium, supports the popular chrome extensions.

Speeding Up Page Loads

We set up our arch system to use the tmpfs for Brave’s cache, speeding up the loads of locally stored web assets and reducing wear on our ssd. The information which needs to remain persistent is periodically synced to the local storage automatically.

Install Brave from the AUR. Browsers are large and take a long time to compile. Fortunately, there is a binary Brave package available to us:

$ yay -S brave-bin

Install the profile-sync-daemon using the following command:

$ sudo pacman -S profile-sync-daemon

Install the profile sync daemon support for Brave from the AUR using the following command:

$ yay -S profile-sync-daemon-brave

Run the following command to automatically generate the configuration file at ~/.config/psd/psd.conf:

$ psd

----------------------------------

# $XDG_CONFIG_HOME/psd/psd.conf

#

# For documentation, refer man 1 psd or to the wiki page

# https://wiki.archlinux.org/index.php/Profile-sync-daemon

## NOTE the following:

## To protect data from corruption, in the event that you do make an edit while

## psd is active, any changes made will be applied the next time you start psd.

# Uncomment and set to "yes" to use overlayfs instead of a full copy to reduce

# the memory costs and to improve sync/unsync operations. Note that your kernel

# MUST have this module available in order to use this mode.

#

#USE_OVERLAYFS="no"

# Uncomment and set to "yes" to resync on suspend to reduce potential data loss.

# Note that your system MUST have gdbus from glib2 installed to use this mode.

#

#USE_SUSPSYNC="no"

# List any browsers in the array below to have managed by psd. Useful if you do

# not wish to have all possible browser profiles managed which is the default if

# this array is left commented.

#

# Possible values:

# chromium

# chromium-dev

# conkeror.mozdev.org

# epiphany

# falkon

# firefox

# firefox-trunk

# google-chrome

# google-chrome-beta

# google-chrome-unstable

# heftig-aurora

# icecat

# inox

# luakit

# midori

# opera

q# opera-beta

# opera-developer

# opera-legacy

# otter-browser

# qupzilla

# qutebrowser

# palemoon

# rekonq

# seamonkey

# surf

# vivaldi

# vivaldi-snapshot

#

#BROWSERS=()

-------------------------------------------

Modify the configuration file to suit your needs. By default, the profile sync daemon’s tmpfs cache is applied to all the supported browsers (including Brave with the added package that we installed).

Enable the service using the following command:

$ systemctl --user enable psd

The easiest way to kill all browsers and start the service is to log out and log back in.

Conclusion

Now, your temporary Brave cache data will be stored in RAM the next time you launch it. It will sync the persistent information to the disk and reload that if the system is rebooted or crashes. It is fast, efficient, and consumes some relatively few resources. The performance boost is undeniable.

Share Button

Source: linuxhint.com

Leave a Reply