Page 1 of 1

Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 6:47 am
by trister

Hello,
After many years of running puppy/dog linuxes I have pinpointed the main major factor that slows surfing is the Google Chrome writing of data & cache in drive.

I tried moving the whole OS to a simple USB3 and when I tried to browse using google chrome I had major slowdown issues (NOTE: I have 4GB and i5).

The current solution that I use is an external SSD drive and speed is amazing.
If I move the same frugal install to a medium USB3 stick then when I open chrome surfing hangs for seconds many times.

I know that the slowdown is from the slow write speed of the USB.

Is there a Chrome parameter that will reduce disk usage with Google Chrome?

Thanks in advance


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 8:27 am
by fredx181

Something like this perhaps ?
google-chrome-stable --disk-cache-size=10000000 --media-cache-size=10000000


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 9:02 am
by ETP

Hi @trister & fredx181,

You are not short of memory with 4GB so can bypass the drive speed issue totally by
placing the cache in RAM which is faster than any NVME, SSD, hard drive or USB3 stick.
The cache will be cleared when you reboot or on a manual ad hoc basis during a chrome session.
The type of install and user (spot/root) do not matter.

Code: Select all

google-chrome-stable --disk-cache-dir=/tmp/cache

Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 9:26 am
by trister

Thank you both. :)
I have tried both solutions in the past.
Initial I tried fred's solution but it didn't make much difference because the delay was caused by the many different small files that cache writes. With this solution I kept having many thousands of files in cache folder. I tried to find a parameter that limited number of files but did not found any.

About ETP solution I did try this in the past but not with many tests. I think this solved half the problem but I did have some issues with the user-data folder.

My current command :

Code: Select all

sudo -u puppy google-chrome-stable --user-data-dir=/home/puppy/.data/google-chrome-stable_puppy_user_data_dir --disk-cache-dir=/home/puppy/.cache/google-chrome-stable_puppy_user_cache_dir --media-cache-size=10000000 "\$@"

Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 9:59 am
by xenial

have you perused the chrome://flags to see if some caching can be disabled.If i am correct chrome relies on pre-fetching and caching to give it the supposed speed.

Also there is a way of turning off caching but it means opening the devtools window permanently.
I think firefox and firefox based browsers do have an advantage here by having the ability to disable cache but it comes at the expense of bandwith and speed reductions especially if you are on a limited network speed.

Just out of curiousity and i am not sure if it is feasible but can the chrome cache directory be made read only.... :shock: :shock:
Might have disastrous results but experimentation is all good... :D :D


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 3:55 pm
by trister
trister wrote: Thu Apr 14, 2022 9:26 am

About ETP solution I did try this in the past but not with many tests. I think this solved half the priblem but I did have some issues with the userdata folder.

I did some more tests. With userdata on the USB and Cache in RAM chrome still has incredible delays...


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 4:24 pm
by fredx181

Note that on Puppy /tmp is probably a RAM disk but not on DebianDog by default, perhaps try /dev/shm OR /mnt/live (RAM disk)
See df -h | grep tmpfs
E.g:
root@live:~# df -h | grep tmpfs
Filesystem Size Used Avail Use% Mounted on

tmpfs 1,9G 1,9M 1,9G 1% /mnt/live
devtmpfs 10M 0 10M 0% /dev
tmpfs 2,3G 52M 2,2G 3% /mnt/live/memory/changes
tmpfs 376M 864K 375M 1% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 752M 29M 723M 4% /dev/shm
tmpfs 376M 4,0K 376M 1% /run/user/0


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 14, 2022 6:29 pm
by trister

I run with the EXIT: parameter so I guess everything is in RAM ..

Code: Select all

root@live:~ $ df -h | grep tmpfs
tmpfs           3,9G  4,3M  3,9G   1% /mnt/live
devtmpfs        3,9G     0  3,9G   0% /dev
tmpfs           4,6G   82M  4,6G   2% /mnt/live/memory/changes
tmpfs           3,9G   20M  3,9G   1% /dev/shm
tmpfs           1,6G  1,4M  1,6G   1% /run
tmpfs           5,0M  4,0K  5,0M   1% /run/lock
tmpfs           785M   20K  785M   1% /run/user/0

Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Fri Apr 15, 2022 4:13 pm
by trister

A parameter like EXIT: for chrome (run in ram save only on exit) would solve much speed problems and would expand HDD/USB life...


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Sun Apr 17, 2022 6:01 am
by Phoenix
trister wrote: Fri Apr 15, 2022 4:13 pm

A parameter like EXIT: for chrome (run in ram save only on exit) would solve much speed problems and would expand HDD/USB life...

For that you'd need a wrapper script to do that. Or another utility. There's stuff on how to do this over at the Arch Linux wiki.


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Sun Apr 17, 2022 8:51 pm
by dancytron

I just saw this...

This is what I run in my .desktop file to put Chrome on the /live/image/ (the Debian dog equivalent of /mnt/home).

Code: Select all

Exec=ddliveapp google-chrome-stable --disk-cache-size=10000000 --media-cache-size=10000000 --user-data-dir=/live/image/ChromeSettings/config --disk-cache-dir=/live/image/ChromeSettings/cache %U

The trick is that you have to set the folder /live/image/ChromeSettings/ so that the browser has access to it, in the case of Debian Dog so it is owned by "puppy" id (in Puppy it would be spot).

If you are having trouble doing something, try creating a subfolder and setting the permissions...


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Mon Apr 18, 2022 8:11 pm
by Mia_White

thanks for the discussion


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 21, 2022 6:50 am
by trister
dancytron wrote: Sun Apr 17, 2022 8:51 pm

I just saw this...

This is what I run in my .desktop file to put Chrome on the /live/image/ (the Debian dog equivalent of /mnt/home).

Code: Select all

Exec=ddliveapp google-chrome-stable --disk-cache-size=10000000 --media-cache-size=10000000 --user-data-dir=/live/image/ChromeSettings/config --disk-cache-dir=/live/image/ChromeSettings/cache %U

The trick is that you have to set the folder /live/image/ChromeSettings/ so that the browser has access to it, in the case of Debian Dog so it is owned by "puppy" id (in Puppy it would be spot).

If you are having trouble doing something, try creating a subfolder and setting the permissions...

Thanks for the answer @dancytron!
This solution saves permanetly ChromeData at shutdown?

(actually my configuration is a bit more complex than that but this is a good starting point... - I do not save anything to change.dat .Chrome save directly to a forlder in my hard disk)
(edit)I just saw that you also save to /nmt/home/ - that is what I was doing. /mnt/home/ is in my USBdiskdrive and this creates the delays... (/edit)


Re: Google Chrome - Reduce disk access to increase speed in USB drive

Posted: Thu Apr 21, 2022 11:32 pm
by dancytron

If you put it directly on a drive (like /mnt/sda1/chromestuff or /mnt/home/chromestuff or in DD /live/image/chromestuff, it saves in real time. If you put it in the filesystem, like under /root/chromestuff or /opt/chromestuff, then it saves when you click the save button or on exit if you are Pupmode 13 and therefore have the save button.

In Puppy it would be (I think off of the top of my head) it is run-as-spot not ddliveapp or run-as-user.