Slow, clunky UI and frequent freezes

For a long while I have been having problems with the performance of KDE without any solution. I tried pretty much everything I found on this forum related to it to no success.

The issue is that my interaction with anything in the UI (going to the application launcher, file brower, clicking on stuff) often lags very much, with random freezes of up to @1 second. This is aggravated when I’m downloading something, which usually makes the UI unusable for a couple of minutes.

The issue with downloading made me think it might be some hardware problem with the disks but I couldn’t find any issue.

I tried to check if anything is faulty (ram, HDD, SDD, graphics card) but all my tests don’t point to any problem there (also I use my PC for gaming and I have 0 problems in games, but the moment I use the KDE UI it’s very slow).

Given my spec I would assume it should be blazing fast:

System:
  Host: elysium Kernel: 6.6.9-x64v2-xanmod1-MANJARO arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.2.4 Distro: Manjaro Linux
Machine:
  Type: Desktop Mobo: Micro-Star model: Z390-A PRO (MS-7B98) v: 1.0
    serial: <superuser required> UEFI: American Megatrends v: 1.C0
    date: 10/10/2020
CPU:
  Info: 8-core model: Intel Core i7-9700K bits: 64 type: MCP cache: L2: 2 MiB
  Speed (MHz): avg: 4697 min/max: 800/3601 cores: 1: 4697 2: 4697 3: 4697
    4: 4697 5: 4697 6: 4697 7: 4697 8: 4697
Graphics:
  Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] driver: i915 v: kernel
  Device-2: NVIDIA TU106 [GeForce RTX 2070] driver: nvidia v: 550.135
  Device-3: Ruision UVC Camera driver: snd-usb-audio,uvcvideo type: USB
  Display: x11 server: X.Org v: 21.1.14 with: Xwayland v: 24.1.4 driver: X:
    loaded: modesetting,nvidia gpu: i915,nvidia,nvidia-nvswitch resolution:
    1: 2560x1440~60Hz 2: 1920x1080~60Hz
  API: EGL v: 1.5 drivers: iris,nvidia,swrast
    platforms: gbm,x11,surfaceless,device
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 550.135
    renderer: NVIDIA GeForce RTX 2070/PCIe/SSE2
  API: Vulkan v: 1.4.303 drivers: N/A surfaces: xcb,xlib
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo de: kscreen-console,
    kscreen-doctor, xfce4-display-settings gpu: nvidia-settings,nvidia-smi
    wl: wayland-info x11: xdpyinfo, xprop, xrandr
Audio:
  Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel
  Device-2: NVIDIA TU106 High Definition Audio driver: snd_hda_intel
  Device-3: Ruision UVC Camera driver: snd-usb-audio,uvcvideo type: USB
  Device-4: C-Media Blue Snowball driver: hid-generic,snd-usb-audio,usbhid
    type: USB
  API: ALSA v: k6.6.9-x64v2-xanmod1-MANJARO status: kernel-api
  Server-1: PipeWire v: 1.2.7 status: active
Network:
  Device-1: Intel Ethernet I219-V driver: e1000e
  IF: eno1 state: up speed: 1000 Mbps duplex: full mac: 00:d8:61:10:83:67
  IF-ID-1: virbr0 state: down mac: 52:54:00:a0:ff:3f
Bluetooth:
  Device-1: Cambridge Silicon Radio Bluetooth Dongle (HCI mode) driver: btusb
    type: USB
  Report: rfkill ID: hci0 state: up address: see --recommends
Drives:
  Local Storage: total: 2.05 TiB used: 1.43 TiB (70.1%)
  ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 960 EVO 250GB
    size: 232.89 GiB
  ID-2: /dev/sda vendor: Seagate model: ST2000DM008-2FR102 size: 1.82 TiB
Partition:
  ID-1: / size: 227.98 GiB used: 139.16 GiB (61.0%) fs: ext4
    dev: /dev/nvme0n1p1
  ID-2: /boot/efi size: 196.9 MiB used: 298 KiB (0.1%) fs: vfat
    dev: /dev/nvme0n1p2
  ID-3: /home size: 1.79 TiB used: 1.3 TiB (72.6%) fs: ext4 dev: /dev/sda1
Swap:
  ID-1: swap-1 type: file size: 8 GiB used: 6.96 GiB (87.0%) file: /swapfile
Sensors:
  System Temperatures: cpu: 45.0 C pch: 46.0 C mobo: N/A gpu: nvidia
    temp: 33 C
  Fan Speeds (rpm): N/A gpu: nvidia fan: 17%
Info:
  Memory: total: 16 GiB available: 15.53 GiB used: 11.74 GiB (75.6%)
  Processes: 415 Uptime: 26m Shell: Zsh inxi: 3.3.37

Kernel: 6.6.9-x64v2-xanmod1-MANJARO

Could there be a process hammering your CPU? If you have a look at the output of htop, you can see if anything is running hot.

That is not an official Manjaro kernel. I would advise you to try one of the officially supported kernels first, and especially so if you have Nvidia graphics.

2 Likes

I haven’t seen any issue with the load CPU or RAM-wise. I also tried looking into the logs in dmesg and journalctl for various issues but found nothing useful.

I will also try with the official kernel, but afaik I had the same problem before.

Just noting that your swap file seems to be working overtime - 87% seems rather excessive - even though swap is meant to be used when needed.

It looks like you could easily run out of memory at any time, and have probably been close to it at times.

You could:

  • Buy and install more physical RAM
  • Increase the size of your swap file - you currently have space for it on /.
  • Create a swap partition - at the expense of a small part of your /home space.

With your current RAM I suggest increasing swap to 16 GB, and see how much difference that makes.


Note that there may also be other contributing factors.

Regards.

4 Likes

When this happens check your memory & CPU usage and report more in detail.

As soon as swap is started to be required it’s completely normal that the system slows down as memory pages have to be written to disk which is dramatically slower than transfering them inside of your RAM.

Where do you have your swap file? If it’s on the HDD, which is extremly slower than the SSD, then better place a swap partition on /dev/nvme0n1.

Also, your /home being placed on the HDD slows down your system a bit. Better put it on /dev/nvme0n1.

2 Likes

I think there might be an issue there, but not due to lack of memory. I did notice at one point that too much swap is being used despite having enough free ram.
Here’s my current system usage (I also increased the swapfile to 16GB). Funny enough, by increasing the size of the swap, not that much swap is used anymore.

I saw by running “cat /proc/sys/vm/swappiness” that my swappiness is set to 30. Before increasing the size of the swap file I played along with this value and it seemed to improve performance if I set it to 0 or run swapoff.

While downloading something it looks like this but doesn’t seem to freeze anymore.

I would way this fixed my download freezes and partialy fixed the slow UI.

Making the swap file/partition larger has zero effect on the start of using swap.

This is not the same. Even with swappiness=0 swapping can occur. In your case I would leave it between 10 and 35.

Again: Where is your swap file located?

Making the swap file/partition larger has zero effect on the start of using swap.

I know, I was saying I find it funny that now it was way less used than when I did the thread and wasn’t using the PC more intensely.

This is not the same. Even with swappiness=0 swapping can occur. In your case I would leave it between 10 and 35.

True, but I had enough free RAM so, in both cases, no swap was being used regardless.

Again: Where is your swap file located?

/swapfile which is on the SSD

1 Like

If you are often run into swap then you either could think about the processes you run in parallel or add RAM.

The thing is I always have alot of free RAM and I’m not sure which processes are using the swap, but it seems to always due to the swapiness and not due to being out of memory.

I don’t have much running, at least now when doing these tests. The most intensive are: Brave browser, discord, steam (+ a torrent client to test the downloading issue).

But even if I run a game in parallel to alt+tab-ing into the browser of discord it works great if I don’t interact directly with any desktop environment element.

Well, when we’re talking about RAM and swap together, the two combined can be referred to as memory.

@Wollie gave quite a nice description of how they work together in another topic earlier today:

Memory usage will naturally vary as you use the machine. While minimal swap might be used at this moment, as soon as you start pushing the envelope, it’s possible to fill RAM and then fill swap again.

The larger amount of swap space will certainly help, but if it were me I’d want to ensure that my blazing fast computer has more than enough physical RAM for my applications, browsers and games to live in while they are running; as well as sufficient swap.

I’d suggest a minimum of 16GB RAM would make all the difference long term; but all I can do is advise; the rest is up to you. :smile_cat:

Regards.

1 Like

I have 16GB of RAM, but that’s my issue here, it shouldn’t be this slow at rest (when i’m just using the browser).

You can see in the screenshots of htop above there’s not much going on. In the second one there are 4GB or RAM (with the rest used for file caching) used and 5.5GB of swap.

I’m familiar with how swap works, while I understand that my low 8GB swap file might have affected the freezes when I’m downloading stuff and alot of memory is used, I don’t think it explains much the usual case.

Yes, so you do (I still had “8GB” in my head due to the previous swap file size) – 32 GiB RAM is the amount you could aim for; whenever that might be practical.

Personally, I find 64 GiB is more suitable, which may be overkill for some, but it really depends on the use case; for example, I do some video editing occasionally and also use VM’s which require the extra overhead.

So, that’s 11.74 Gib (of 15.53 GiB available RAM) plus 6.96 Gib (of 8 GiB swap) – before you increased the swap file size.

As indicated by that output, you could easily be close to maxing out available resources in a very short time, dependent on how many concurrent applications were running, and their memory requirements;

You need to think of the total RAM and swap being used at any given time, rather than how its distributed.

Let’s take another quick snapshot now – generate your system information again, and post it for comparison:

inxi --admin --verbosity=8 --filter --no-host --width

Before I leave; (Pondering) do you use many flatpak or electron based apps; perhaps from the AUR?

On that note, I’m out for the day.

Regards.

In my case (on the other machine, with spinning rust) going into swap by more than a few GB causes dramatic slowdowns.

The browser is always the culprit in my case (Firefox), when used for watching YouTube videos. I guess FF just leaks memory like a sieve. I don’t know about Brave as have never installed it, but wouldn’t be surprised if it’s down to the same thing.

Cure (at least temporarily) is to restart the browser every so often. And keep an eye on memory to see when this occurs:

watch -n30 free -h

I usually need to restart the browser every week or so to free up accumulated crud.

You are using an unsupported (xanmod) - kernel.

sudo pacman -Syu
mhwd-kernel -i linux612

As a desktop - your system should be using the Nvidia driver - instead you are are using modesetting on intel.

The whole combination looks awkward - I think the clunkyness you are referring is your own doing.

I suggest you download the latest iso - boot as a live system - just to verify …

You can avoid using a removable device, see → [HowTo] Boot Manjaro ISO directly with GRUB

The package manjaro-get-iso provides a CLI style download/verification tool - currently only in testing and unstable branch.

Applications / Manjaro Get Iso · GitLab
[root tip] [Utility Script] Using python to download and verify a Manjaro ISO

Another option is the GUI styled app manjaro-iso-downloader

sudo pacman -Syu manjaro-iso-downloader
1 Like

I switched to the official 6.12 kernel but don’t see any difference.

As a desktop - your system should be using the Nvidia driver - instead you are are using modesetting on intel.

It is using the Nvidia driver, the setup is due to using Optimus Manager (which is set to use the Nvidia GPU). I can see from the nvidia-smi that the X processes are running there.

(The only reason I’m using optimus manager is because I have a dual monitor setup, one with a display port going into the GPU port and and DVI one going into the motherboard port and couldn’t make it work otherwise).

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.135                Driver Version: 550.135        CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 2070        Off |   00000000:01:00.0  On |                  N/A |
| 17%   31C    P8              6W /  175W |    1018MiB /   8192MiB |     15%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      1300      G   /usr/lib/Xorg                                 544MiB |
|    0   N/A  N/A      1561      G   /usr/lib/kglobalacceld                          1MiB |
|    0   N/A  N/A      1604      G   /usr/bin/ksmserver                              1MiB |
|    0   N/A  N/A      1606      G   /usr/bin/kded6                                  1MiB |
|    0   N/A  N/A      1607      G   /usr/bin/kwin_x11                             109MiB |
|    0   N/A  N/A      1634      G   /usr/bin/plasmashell                          132MiB |
|    0   N/A  N/A      1662      G   /usr/lib/kactivitymanagerd                      1MiB |
|    0   N/A  N/A      1667      G   /usr/bin/gmenudbusmenuproxy                     1MiB |
|    0   N/A  N/A      1668      G   /usr/bin/kaccess                                1MiB |
|    0   N/A  N/A      1670      G   /usr/lib/org_kde_powerdevil                     1MiB |
|    0   N/A  N/A      1671      G   /usr/lib/xdg-desktop-portal-kde                 1MiB |
|    0   N/A  N/A      1672      G   /usr/bin/xembedsniproxy                         1MiB |
|    0   N/A  N/A      1793      G   /usr/bin/kdeconnectd                            1MiB |
|    0   N/A  N/A      1796      G   /usr/bin/yakuake                               33MiB |
|    0   N/A  N/A      1966      G   ...yOnDemand --variations-seed-version         46MiB |
|    0   N/A  N/A      2388      G   ...local/share/Steam/ubuntu12_32/steam         11MiB |
|    0   N/A  N/A      2439      G   /usr/bin/alacritty                              9MiB |
|    0   N/A  N/A      3215      G   ...58,262144 --variations-seed-version         86MiB |
|    0   N/A  N/A      4423    C+G   ....local/share/Steam/logs/cef_log.txt          6MiB |
|    0   N/A  N/A      4676      G   /usr/lib/baloorunner                            1MiB |
+-----------------------------------------------------------------------------------------+

I will also try to boot on a live USB too see how that works.

That is a strange usecase - especially for a desktop system - you should not use optimus manager - for what I know it is designed for laptop systems - to properly switch between GPU for power reasons.

Depending on form factor the desktop GPU has 2 to 4 connectors.

Have you thought of using Prime instead?

This is the official Nvidia method to support switchable graphics.