Low Ram usage but system laggy

Hi,

So I have 16GB of RAM on my system running AMD 3 2200G with in built graphics and allocated vRAM at 500mb.

The issue is.. when I reach around 10gigs of RAM usage, my system slows down to a crawl..

I couldn't understand this at first.. I was checking the RAM usage using the system monitor GUI apps.

Then I read some online content and found I should be using "free -h" command.

Here's the result I got:

And Free -h

 ╭─[email protected] in ~ took 3s
 ╰─λ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       7.1Gi       1.4Gi       389Mi       6.7Gi       7.2Gi
Swap:           30Gi       277Mi        29Gi

As you can see.. even though it shows the total is 15GB and I have used 7.1GB.. I only have 1.4G left..

Now, this makes perfect sense why the system starts to lag when I reach 10GB of RAM usage.

But why can I just use 10GB of RAM?

Where is the rest 5GB or so??

Other info you might be interested in:

inxi -Fxxxza

 ╭─[email protected] in ~ 
 ╰─λ inxi -Fxxxza
System:    Kernel: 5.12.15-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0 
           parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=ffa2da0a-139d-47f4-9350-125eeef36842 
           rw [email protected] quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0 
           systemd.unified_cgroup_hierarchy=1 resume=UUID=d3f1d17d-ce5e-4b8c-a9d8-3eef38cddc13 loglevel=3 
           Desktop: GNOME 40.3 tk: GTK 3.24.30 wm: gnome-shell dm: GDM 40.0 Distro: Garuda Linux 
           base: Arch Linux 
Machine:   Type: Desktop System: Gigabyte product: A320M-S2H v: N/A serial: <filter> 
           Mobo: Gigabyte model: A320M-S2H-CF v: x.x serial: <filter> UEFI-[Legacy]: American Megatrends 
           v: F22 date: 03/15/2018 
CPU:       Info: Quad Core model: AMD Ryzen 3 2200G with Radeon Vega Graphics bits: 64 type: MCP arch: Zen 
           family: 17 (23) model-id: 11 (17) stepping: 0 microcode: 8101007 cache: L2: 2 MiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 27947 
           Speed: 2440 MHz min/max: 1600/3500 MHz boost: enabled Core speeds (MHz): 1: 2440 2: 2196 
           3: 2736 4: 1871 
           Vulnerabilities: Type: itlb_multihit status: Not affected 
           Type: l1tf status: Not affected 
           Type: mds status: Not affected 
           Type: meltdown status: Not affected 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 
           mitigation: Full AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling 
           Type: srbds status: Not affected 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: AMD Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] vendor: Gigabyte 
           driver: amdgpu v: kernel bus-ID: 07:00.0 chip-ID: 1002:15dd class-ID: 0300 
           Display: x11 server: X.Org 1.20.12 compositor: gnome-shell driver: loaded: amdgpu,ati 
           unloaded: modesetting alternate: fbdev,vesa display-ID: :1 screens: 1 
           Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9") 
           Monitor-1: HDMI-A-0 res: 1920x1080 hz: 60 dpi: 82 size: 598x336mm (23.5x13.2") 
           diag: 686mm (27") 
           OpenGL: renderer: AMD Radeon Vega 8 Graphics (RAVEN DRM 3.40.0 5.12.15-zen1-1-zen LLVM 12.0.0) 
           v: 4.6 Mesa 21.1.4 direct render: Yes 
Audio:     Device-1: AMD Raven/Raven2/Fenghuang HDMI/DP Audio driver: snd_hda_intel v: kernel 
           bus-ID: 07:00.1 chip-ID: 1002:15de class-ID: 0403 
           Device-2: AMD Family 17h HD Audio vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus-ID: 07:00.6 chip-ID: 1022:15e3 class-ID: 0403 
           Device-3: C-Media Blue Snowball type: USB driver: hid-generic,snd-usb-audio,usbhid 
           bus-ID: 3-3:3 chip-ID: 0d8c:0005 class-ID: 0300 serial: <filter> 
           Sound Server-1: ALSA v: k5.12.15-zen1-1-zen running: yes 
           Sound Server-2: JACK v: 0.125.0 running: no 
           Sound Server-3: PulseAudio v: 14.2 running: yes 
           Sound Server-4: PipeWire v: 0.3.31 running: yes 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Gigabyte driver: r8169 
           v: kernel port: f000 bus-ID: 06:00.0 chip-ID: 10ec:8168 class-ID: 0200 
           IF: enp6s0 state: up speed: 100 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 698.65 GiB used: 179.23 GiB (25.7%) 
           SMART Message: Required tool smartctl not installed. Check --recommends 
           ID-1: /dev/sda maj-min: 8:0 vendor: Seagate model: ST500DM002-1BD142 size: 465.76 GiB 
           block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> 
           rev: KC48 scheme: MBR 
           ID-2: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 860 EVO 250GB size: 232.89 GiB 
           block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s rotation: SSD serial: <filter> 
           rev: 3B6Q scheme: GPT 
Partition: ID-1: / raw-size: 450.72 GiB size: 450.72 GiB (100.00%) used: 179.23 GiB (39.8%) fs: btrfs 
           dev: /dev/sda1 maj-min: 8:1 
           ID-2: /home raw-size: 450.72 GiB size: 450.72 GiB (100.00%) used: 179.23 GiB (39.8%) fs: btrfs 
           dev: /dev/sda1 maj-min: 8:1 
           ID-3: /var/log raw-size: 450.72 GiB size: 450.72 GiB (100.00%) used: 179.23 GiB (39.8%) 
           fs: btrfs dev: /dev/sda1 maj-min: 8:1 
           ID-4: /var/tmp raw-size: 450.72 GiB size: 450.72 GiB (100.00%) used: 179.23 GiB (39.8%) 
           fs: btrfs dev: /dev/sda1 maj-min: 8:1 
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) 
           ID-1: swap-1 type: zram size: 15.14 GiB used: 277.5 MiB (1.8%) priority: 100 dev: /dev/zram0 
           ID-2: swap-2 type: partition size: 15.03 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/sda2 
           maj-min: 8:2 
Sensors:   System Temperatures: cpu: 49.1 C mobo: N/A gpu: amdgpu temp: 49.0 C 
           Fan Speeds (RPM): N/A 
Info:      Processes: 369 Uptime: 7h 56m wakeups: 0 Memory: 15.14 GiB used: 7.92 GiB (52.3%) Init: systemd 
           v: 249 tool: systemctl Compilers: gcc: 11.1.0 clang: 12.0.1 Packages: 1338 pacman: 1330 
           lib: 354 flatpak: 8 Shell: fish v: 3.3.1 running-in: gnome-terminal inxi: 3.3.05 

Have you checked recently if you need a btrfs balance?

4 Likes

No, I haven't!

But I balanced my system about a month ago!

How often do I need to balance it???

It depends on the system use, how much you install, uninstall and especially timeshift rollback

4 Likes

I see,

Okay I will do a Balance overnight.. It takes a couple of hours as you know!

I will try to see if the lag gets better tomorrow and let you know!

Thanks for now... :slight_smile:

But I don't think it will help much if the system slows down only at a certain RAM usage...

3 Likes

Oh...

I was wondering.. Can it be because of the zRam feature?

I hope someone will help better here.
I think that the main side effect of using zram is high CPU usage, which of course can slow down the system.
I don't know...

1 Like

It may be an indication misunderstanding.
I am not sure, but if I try to add up the values from your output, I suspect your RAM is really exhausted, and the lag is really normal.
I maybe wrong, but have you calculated RAM usage from running tasks? Do you say there are no memory hungry tasks running and RAM should suffice?

Provide facts from terminal output. More than what you posted already.
Check Archwiki on the subject.

4 Likes

Also, in addition to a btrfs balance, be sure to reboot after any balance or large system update.

Also install and run htop in the terminal to keep a constant view of your resource usage.

Edit:

For and in depth troubleshooting guide see:

3 Likes