4

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?

0
1

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
1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.