I have my laptop for about 4 - 5 years with a 4 GB RAM and until last year i was using windows when I noticed a gradual slowness in my laptop which I think it is related to my low RAM and it became to a good reason to migration to Ubuntu. but even now that I use Ubuntu I can still see this slowness growing day by day. at the moment I am uninstalling heavy apps and do not watch movies with my Laptop. my question is if there is any way to stop this slowness without changing my RAM or any way to reduce pressure over the RAM or ...? My Laptop Model: ACER Aspire E 15 My Swappiness: 60 My Free -h: total used free shared buff/cache available Mem: 3.7Gi 2.0Gi 240Mi 254Mi 1.5Gi 1.3Gi Swap: 2.0Gi 0B 2.0Gi
1 Answers
Ubuntu is a little bit heavy on ram usage since it uses Gnome as its Desktop Environment.
There are few things that you should change
- Change Desktop Environment
- Create a Swap file
- Decrease Swappiness
Desktop Environments
You can install lighter versions of ubuntu, such as Xubuntu or Lubuntu. (Both are ubuntu based and onlu differ in the Desktop Environment i.e. how the user interface looks like)
Or an easier solution is to just install the Desktop Environment.
# For Xubuntu
sudo apt-get install xubuntu-desktop
#For Lubuntu
sudo apt-get install lubuntu-desktop
There other Desktop Environments which you can try, but these are the popular ones. You can then switch between Desktop Environments from the login screen Changing DE from login screen (Image by HowToGeek)
Swap File (or partition)
You should have a swap file/partition that is at least equal to the amount of ram you have. (I had say use 6GB). Swap is necessary to prevent Ubuntu from hanging when the ram gets full (Frees RAM by writing its content disk). It also helps in hibernating.
#Check if you have a Swap partition/file.
sudo swapon --show
#If you get an output similar to this then you have a swap file/partition
NAME TYPE SIZE USED PRIO
/dev/sda2 partition 1.9G 0B -2
If you don't have one: you can follow a guide such as this one
Swappines
Lastly you should decrease the swappiness value to utilize your RAM and decrease the usage of slow disk. you can check for the current swappiness with:
cat /proc/sys/vm/swappiness
It should be 60 by default which is not ideal. Change it by opening a text editor with root privileges (sudo)
sudo nano /etc/sysctl.conf
Then change the swappiness to your value of choice (5 seems good for me)
#find the line with:(vm.swappiness) and change the value
vm.swappiness=5
(to exit nano with saving use Ctrl+X, Y, Enter )
-
Thank You So much @Westofer it was so helpful but in the last part i could not find anything matches "vm.swappiness=5" in that text i even searched with nano but nothing finde – Raman Aug 23 '20 at 09:41
-
@Raman I said it incorrectly. you can check here for a step by step guide or simply add that line, save and reboot You are welcome :) – Aug 23 '20 at 10:35
free -h
andsysctl vm.swappiness
. – heynnema Aug 22 '20 at 21:00