Score:4

Browsers are laggy in Ubuntu 20.04 LTS

tr flag

I use Firefox and Microsoft edge and both of them are laggy. My internet is fine and page loading is fine but everything is slow and laggy. I can’t watch videos using 720p60 and higher because of this.

I tried turning hardware acceleration off and on, but it seems to make no difference.

Specs:

  • Intel i5 650
  • Intel HD graphics card
  • HDD with 1 terabyte disk space
  • 8GB RAM

Swap size is 2GB.

I'm using Ubuntu 20.04 with desktop environment of LXQt, Budgie, Cinnamon, GNOME 3, GNOME classic and awesome window manager.

What could be the problem, and how can I fix it?

Score:1
tr flag

Following the steps in this answer, as suggested by Algnis, I used

sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1G count=8 

to add 8G of swap space.

After that I did

sudo chmod 600 /swapfile 

so that only root users can read and write to the swap file.

Then I used

sudo mkswap /swapfile

to make the swap file usable.

I added this like to /etc/fstab

/swapfile none swap sw 0 0 

to add the new swap file.

Finally I ran

sudo sysctl vm.swappiness=10

as also suggested by Algnis.

I made sure to reboot my system to get it working and used free -h to make sure my new swap file was there and working.

Score:1
my flag

After talking with the OP in comments, I suspect this issue is related to swap.

Solutions that I recommend

  • First, increase the swap size to 8 GB or whatever you prefer

  • Decrease the swappiness value to 10

Why should you do this?

Well... I think the issue occurs due to swappiness

The OP's swappiness was way too much which lead to using that small 2 GB swap size. So after increasing the swap size we also decreased the swappiness value so that there should be no error in future, thus the problem was solved.

How to increase swap

What is swap?

Swap can be defined as Virtual memory. Virtual memory means ram only. But In virtual memory, Ram is used in a storage medium like Hard disk or SSD or On which your OS is installed. Whenever the Ram is full It will store the Ram files in the allocated space for swap. It is not as fast as a Normal ram but its speed depend on the speed of your storage medium

How to configure swappiness

What is swappiness?

The Linux kernel provides a tweakable setting that controls how often the swap file is used, called swappiness.

A swappiness setting of zero means that the disk will be avoided unless necessary (you run out of memory), while a swappiness setting of 100 means that programs will be swapped to the disk almost instantly.

The Ubuntu system comes with a default of 60, meaning that the swap file will be used fairly often if the memory usage is around half of my RAM. You can check your own system's swappiness value by running:

$ cat /proc/sys/vm/swappiness
60
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.