There are lot of similar questions and I have read many answers and have tried many things, nothing has helped so far.
My machine suddenly becomes slow. Practical observation is when it reaches around 50% of RAM usage, performance of the machine becomes unbearable.
I have 16GB of RAM and 16GB of swap. As far as I can see, swap is not at used. It takes around 5-10 seconds for any action - mouse click or simple application switch using alt-tab. It does respond, eventually.
This is primary work machine and I usually have two eclipse instances running Java 1.8 and Java 11 respectively, chromium browser and few other applications such as emacs, terminal and sometimes firefox. In the background, mysql is usually running.
Top and IOTop does not show any activities going on, but many times, both the applications also freeze.
There are no entries in any of the log files about potential problems. I can try to provide any other relevant data if needed. Machine is up to date for service pack updates.
I can understand it won't use swap if not needed, but not able to resolve unresponsive machine problem. As said earlier, it usually happens when memory usage goes to 50+% of the memory. Switching the applications or even typing in editor are becoming slow performing tasks now.
Output of free command
free -h
total used free shared buff/cache available
Mem: 15G 5.6G 6.9G 481M 3.0G 9.1G
Swap: 15G 0B 15Gfstab
blkid
Edits to provide information as requested. Images are taken after I posted the question. I'm trying now with a new disk attached in addition to previous one. Swappiness is increased and will monitor the effect
71 Answer
It looks like you may have a swap problem. You have BOTH a /var/swapfile AND a swap partition. That's not a problem in as itself, unless the sizes are not correctly set (unknown at this time), or the fstab entries are incorrect (as yours is).
Assuming that /dev/sda5 is at least 4G, as seen by gparted or sudo fdisk -l, we'll modify your swap configuration.
First we'll modify /etc/fstab.
In the terminal app...
sudo -H gedit /etc/fstab # edit fstab
change this...
/var/swapfile none swap defaults 0 0to this...
/var/swapfile none swap sw 0 0then to this...
#/var/swapfile none swap sw 0 0save the file and quit gedit.
reboot
sudo sysctl vm.swappiness # should show a value of 60 after a reboot.
free -h # check swap size