Yeahthisisausername
Posts: 14
Joined: Tue Jan 01, 2019 3:04 am
Location: Norway

[Quick Guide] How to get a better browsing and YouTube experience [vRAM+SWAP]

Tue Jan 01, 2019 3:19 pm

Title says "browsing" and "YouTube", but this applies system wide.

I recently got my hands on a 3B+, and I've been playing around with it this whole week. Suffice to say, the Raspberry Pi isn't exactly a powerful system, and freezes and complete lockups have been the norm. Granted, it's not really made to be used as a daily driver or for heavy tasks, but it's fun to play around with. I recently increased vRAM to 256 MB, which sped things up a little, especially while browsing YouTube in Chromium. I then increased the Swap file from a measly 100 MB to 2048 MB, which is complete overkill to be honest, but it's a solid buffer at least.

The increase of swap has transformed the system from freezing and locking up all the time, to never do it. Lockups are gone, but lag and short pauses will still occur, since the CPU is still weak. I'm now able to use the 3B+ as a regular computer, even though it's a slow one. While I had to mostly keep myself contained to a single tab in Chromium before, I can now have 5-10+ tabs open, and it still won't freeze. It'll be slow, since swap is slow compared to RAM, but you won't have to unplug your Pi and restart it.

I've been reading about some people around here that use the Raspberry Pi as a computer and daily driver, and I highly recommend an increase of swap if you want a more consistent experience and performance, especially on heavier sites like YouTube. If you simply use your Pi as a tool in a robot, NAS etc, then you want long-term stability, and I don't really recommend increasing the swap file, since it will increase read/write operations to the SD card.

Here's a short clip of the now MUCH more tolerable Raspberry Pi. Notice how jumping between tabs is quick, and this is while YouTube is playing in a tab in HD.

https://www.youtube.com/watch?v=dzWHyApZ4PE

NOTE: While this is great, read and write operations to and from swap (i.e SD card) will be much higher than normal, and it will shorten the life of your SD card. You should not do this if you value your SD card. I can't tell you when or if the SD card will get corrupted and destroyed down the road, but you should at least expect it to happen at some point, and you'll have to buy a new one. It won't happen in a day or a week, but it will most certainly happen down the road.

HOW TO:

Increasing vRAM is super easy, and is a default option in Raspbian. You can either do it via the system GUI, or in the terminal.

GUI: Preferences -> Raspberry Pi Configuration -> Performance -> "insert amount". Default is 64 MB, I recommend 256 MB if you can "afford" it. If you have 512 MB of RAM, then you can't really afford it, but if you have 1 GB, then you'll be fine.
Or you can do it via CLI:

Code: Select all

sudo raspi-config
...then go to Advance and then memory_split. Set amount and reboot.

Increasing the size of the swap is a little more complicated, but still very easy:

Code: Select all

sudo nano /etc/dphys-swapfile

Change the amount from 100 to whatever you'd like. If you have a bigger card, like above 32 GB, then feel free to max it out at 2048 MB (which is overkill), or maybe 1024. If you have a smaller card, like 8 or 16 GB, then you'll be good with a 512 MB swap.

Code: Select all

sudo dphys-swapfile setup

Code: Select all

sudo reboot 
After rebooting, open the terminal and type:

Code: Select all

free -h
SWAP should now be increased, and you'll notice that the system will use it more from now on, and your system will generally work better.

Return to “Raspberry Pi OS”