This is from a fresh boot of the system, except sshd I have not started anything else. ram consumption used to be just 126-200 mb now it has jumped so significantly that I am concerned I might have unnecessarily bloated my system:

I intend to use the system as a local server with an optional fully featured WM(Hyprland which is installed, but this screenshot was taken before it was loaded) for occasional use.

Ram conservation is a top priority and I would like to know if such a big jump in usage is normal or are there is something wrong with my system config

  • Shimitar@downonthestreet.eu
    link
    fedilink
    English
    arrow-up
    15
    arrow-down
    2
    ·
    7 days ago

    I don’t see anything wrong here. Ram is supposed to be always as full as possible.

    What is not needed by running programs should be full of disk pages cached. A system with lots of free ram is oversized or abnormal.

    Also, today’s kernels require swap space. On disk is a must for a server, and maybe consider even zram.

    Having swap will allow the kernel to organize it’s memory usage even better.

    Don’t over think ram as that is a field in which you will be wrong and the kernel will be right 99%.

      • eneff@discuss.tchncs.de
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        8 days ago

        I meant like in general…

        I do agree it’s worth investigating if it happens again. My best guess so far would be some kind of data written to a tmpfs. That’d explain it not being associated with a particular process, yet counting towards actual used RAM.

  • qjkxbmwvz@startrek.website
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    8 days ago

    You can also drop cache for debugging by running something like echo 3 | sudo tee /proc/sys/vm/drop-caches

    But remember that the kernel knows best — this RAM will automatically be freed up when needed and you should never run this except for debugging (or maybe benchmarking).

    • MonkderVierte@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      7 days ago

      Rimworld mods sometimes occupy 10gb RAM after a crash/force-close. That one helps.

      But don’t set up a cronjob running it regularly, that causes issues.

  • Xanza@lemm.ee
    link
    fedilink
    English
    arrow-up
    7
    ·
    8 days ago

    It’s allocated memory in the cache. It’s not used, it’s earmarked for first usage.

    This is standard memory management.

    • 2xsaiko@discuss.tchncs.de
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      8 days ago

      I’m pretty sure only the yellow bar on the right of that indicator is cache. Green is actually being used by processes.

  • MonkderVierte@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    7 days ago

    Remove Modemmanager if you don’t use it, replace Network-manager and wpa_supplicant with connman or iwd, maybe look if you can remove elogind since you already use seatd.

    Btw, syslogd, the reference implementation? Not syslog-ng?

    And, uh, Systemd doesn’t do supervision by itself, needs a service for it?

  • inawhilecrocodile@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 days ago
    • You mention this is a server VM and so you probably don’t need NetworkManager or the wpa_supplicant services. If you don’t wish to setup a static IP for the server VM then install and use dhcpcd instead of NetworkManager/wpa_supplicant.

    • Unless you need to use WWAN (2G/3G/4G/5G) devices, you don’t need ModemManager.

    • Depending on your workflow, consider reducing the number of agetty instances to 1. With a single agetty instance, install and use tmux multiplexer when you need more sessions on the physical VM console.

    • I don’t have any experience of using seatd/elogind but I think you may be able to configure USE flags such that you only need seatd installed (i.e. don’t need elogind) and since you need seatd only for running a WM occasionally, why not use seatd-launch to start the WM and not have the seatd daemon running constantly. See: https://github.com/swaywm/sway/wiki/Running-Sway-with-seatd,-elogind-or-systemd‐logind#seatd-launch

    • Lastly, the largest chunk of memory used other than the processes you can see in htop will be the Linux kernel. The Gentoo distribution kernel will have hundreds of drivers for real hardware which make no sense in a Kernel that will be used in a VM (unless you plan to use PCI/USB pass through). So, you should create a custom kernel (https://wiki.gentoo.org/wiki/Kernel/Gentoo_Kernel_Configuration_Guide) which is tailored for a KVM guest.

    To do this (the following are not detailed instructions but just guidance):

    • You start with “make defconfig” which creates a “.config” file with the default options from the ARCH supplied defconfig (e.g. x86_64_defconfig).
    • Then you do a “make kvm_guest.config” which adds config options that makes the kernel bootable as a KVM guest.
    • Next you need to do a “make filesystem.config” which will add config options for filesystems you need the kernel to support. (* see note below)
    • Next you need to do a “make systemd.config” which will add config options for systemd functionality related support. (* see note below)
    • Next you need to do a “make arch_x86.config” which will enable additional config options for some virtual hardware support drivers (* see note below)

    Note 1: The additional “*.config” files mentioned above will need to be copied into the correct place before make will find them and I’ve provided some some sample config files you can use to start with below:

    Note 2: I’m not associated with the above github repo(cyano-linux/qemu-guest-kernel) but I have referenced it when I needed to setup a custom kernel. You can find a little documentation for the above kernel config here: https://github.com/cyano-linux/qemu-guest-kernel/blob/master/config.md