Solved How much memory is too less memory? Is there even such a thing?

Solved issue
Joined
Apr 16, 2023
Messages
161
Reaction score
19
Credits
1,575
Code:
[root@localhost ~]# free -m
               total        used        free      shared  buff/cache   available
Mem:            1763         929         223           7         763         834
Swap:           2047           0        2047

Is anything concerning here? I want to make an alerting mechanism when there is too less memory. But I am not sure which parameters is of concern to me? Is it available? I've read a lot but not found an exact answer so far.
 


Code:
[root@localhost ~]# free -m
               total        used        free      shared  buff/cache   available
Mem:            1763         929         223           7         763         834
Swap:           2047           0        2047

Is anything concerning here? I want to make an alerting mechanism when there is too less memory. But I am not sure which parameters is of concern to me? Is it available? I've read a lot but not found an exact answer so far.
You have too few memory, sorry.
 
I guess it's a bit like your heart rate : if it's too low, you're dead.
 
[root@absTower1 ~]# vmstat 2 4
procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------
r b swpd free buff cache si so bi bo in cs us sy id wa st gu
0 0 616 2546604 335188 47312744 0 0 2 74 250 3 0 1 99 0 0 1
0 0 616 2546352 335188 47312744 0 0 0 3748 980 1456 0 0 100 0 0 0
0 0 616 2546352 335192 47312744 0 0 0 210 897 1393 0 0 100 0 0 0
0 0 616 2545848 335200 47313684 0 0 0 6 1066 1566 0 0 100 0 0 0
[root@absTower1 ~]# free -mh
total used free shared buff/cache available
Mem: 62Gi 15Gi 2.4Gi 84Mi 45Gi 47Gi
Swap: 17Gi 616Ki 17Gi

How much memory when? What are you doing? Just running Linux?
If Linux is running, and that's all you want, then it's enough.
If you need a browser in a GUI, then it might not be enough.

I've gone over 95% a few times. I have very rarely gone into swap space.
As a rule, I like to keep it below 75-80%.

When you start using swap, things slow down quite a bit.
 
These days the minimum is 4GB but 8GB is good...16GB or more is better.
1716433339297.gif
 
These days the minimum is 4GB but 8GB is good...16GB or more is better. View attachment 20113
Yeah, nowdays 16GB is standard, but is slowly moves toward 32GB, I often see my memory go close to full 16GB without playing games.

And for gamers, some strategy games with big maps require as much as 64GB without any issues.
 
@Brief-Wishbone9091 wrote:
an alerting mechanism when there is too less memory

Here's a primitive and basic "alerting mechanism" for when swap gets to the point where only 50% is left free. It plays some sounds to alert the user that swap space is that low. It is named here as the file: swapcheck

Code:
#!/bin/bash
SwapTotal=$(grep SwapTotal /proc/meminfo | awk '{print $2}')
SwapFree=$(grep SwapFree /proc/meminfo | awk '{print $2}')

PercentageSwapLeft=$(echo "$SwapFree" "$SwapTotal" | awk '{print ($1/$2*100)}'

if [ $PercentageSwapLeft -lt 50 ]
then
play /usr/share/sounds/freedesktop/stereo/service-login.oga
play /usr/share/sounds/freedesktop/stereo/service-logout.oga
else
exit 0
fi

Notes:
The script looks into the /proc filesystem instead of using another program like free, ps, top, vmstat etc. It's more direct for the relevant memory information.

The sounds are played by the command: play, which is from the package: sox.
The sound files which are played are in the package: sound-theme-freedesktop, which is a default package in debian and possibly other distros.

To get on-going information about the percentage of swap space being used, the above script can be started with a starter script as follows which is named: swapcheckstart. Once started in this way it will run every 10 seconds to check the swap usage.

Code:
#!/bin/bash
while swapcheck
   do
     sleep 10
   done &

To kill the alerting sounds, a one liner script which is named: swapcheckkill

Code:
#!/bin/bash
kill $(pgrep swapcheckstart)

The three files here were placed in ~/bin, made executable, and so run by the user on a test machine.
The percentage cut-off point and the sleep interval times can be altered to any desired value.

It works here. It could be adapted for memory rather than swap.

The low specs in post #1 will run a text based system and access the net with text based apps like lynx or w3m.

If 50% of swap is being used in such a small system, it'll probably feel like working in treacle.

The more modern way to do this sort of thing is to write a systemd service unit and a systemd timer unit. But such a small system might be better off with an economical sysVinit system.
 
Last edited:
Yeah, nowdays 16GB is standard, but is slowly moves toward 32GB, I often see my memory go close to full 16GB without playing games.

And for gamers, some strategy games with big maps require as much as 64GB without any issues.
Aye, technology moves apace.

Barely 5 years ago, when I used to frequent LinuxQuestions. org on a regular basis, you heard a lot of talk about 32 GB as being "the Holy Grail" (and total overkill in most people's view). Maybe a handful of the regulars had achieved that goal, and most of those were constantly bragging about it, OR finding ways to keep mentioning the fact at every opportunity!

When I moved to this current HP Pavilion desktop in early 2020 (right at the start of the pandemic), I was leaving behind an elderly Compaq desktop from 2004 with just 3 GB of DDR1. The HP is DDR4; I didn't care that the model I bought had only 4GB, since I had every intention of maxing this out to its 32 GB limit as & when funds permitted.

4GB immediately became 8GB, then in May of that year I splashed out on a 16GB kit direct from Crucial. I would have probably been content with that for quite a while, but in October I came across the most unbelievable deal on Crucial RAM kits on Amazon.....specifically, a 32GB kit for just over half of what I'd paid Crucial for that 16 GB kit earlier in the year..! I've never had any problems with Amazon (had an a/c for several years), so I grabbed one...

~~~~~~~~~~~~~~~~~~~~~~~~​

I wouldn't call it "future-proofing", exactly; more like a reaction on my part to having been so restricted with RAM for several years.....I decided I wasn't "going there" again! Still, with Puppy being so economical with system resources, for ME it's as though I had 64GB to play with. I guess the most I've ever seen in use was around 11.5 GB on one memorable occasion. More often than not, the figure is well under half of that.....perhaps a tad more, but only rarely.

(I splashed out on quite a bit that year, one way or another; with the lock-downs in full effect, I had a fair-sized chunk of cash building up in the bank that wouldn't normally have been there. So I made use of some of it...)

Nowadays, of course, 16 GB is pretty much standard from many manufacturers, with all offering at least 32GB as an upgrade or higher-cost purchase option.....and for many, that 64GB option is usually floating around not TOO far away.

(shrug...)


Mike. ;)
 
Last edited:
on my part to having been so restricted with RAM for several years

I had a fair-sized chunk of cash building up in the bank that wouldn't normally have been there. So I made use of some of it...)
Same story here, I have always been using low end laptops and PC's because lack of funds, this PC which I now have was also not the best, but I couldn't bare it any longer and decided to throw several 100's of € into a solid GPU, RAM and the rest of hardware so that I can play what ever game I want (although it's still not enough).

But my major hunger for strong PC in addition to games is development which can easily consume 10GB alone with browser open and 10's of tabs open in same time to research stuff.

Otherwise in idle and for surfing only, 8GB would be just fine.

People who do graphics design, game dev and similar also require crazy strong PC.
It all depends on what one does on his PC.

Honestly I pray that my PC just burns out or something because I'd like to buy brand new one, stronger than this one, but while this one is running fine it would be waste of money.
 
@Caffeine Addict:-

People who do graphics design, game dev and similar also require crazy strong PC.
It all depends on what one does on his PC.

Oh, you're not wrong there..!

Graphic design has been a passion of mine for well over 40 years, dating all the way back to secondary school. It's quite possible to gobble up some serious system resources when you're busy with that kind of thing...

Maybe 12-15 yrs ago, I started to get into video editing, too; another activity that eats up GB after GB of RAM without even trying.

I'm frequently running both activities at the same time. It's just nice not to have to worry about what's going on under the hood, and to simply get on with & enjoy what you're doing.....


Mike. :)
 
It's just nice not to have to worry about what's going on under the hood, and to simply get on with & enjoy what you're doing.....
Certainly, we should enjoy computers while using them.

People go out drink and have fun and spend loads of bucks per one day, why shouldn't we spend same bucks on our PC for similar fun of which will last for years for same cash.
I think this logic holds just fine.
 
I set my swappiness level to a value of 10 so as not to write to much to my hard drive.
The below commands will work for the Debian / Ubuntu based Linux distros.
1st command check swappiness.
2nd command change swappiness level.
3rd command make the change permanent.
Reboot system to apply all changes.

Code:
cat /proc/sys/vm/swappiness

Code:
sudo sysctl vm.swappiness=10

Code:
sudo sed -i '$ a\vm.swappiness = 10' /etc/sysctl.conf
 
@Caffeine Addict:-

It's just nice not to have to worry about what's going on under the hood, and to simply get on with & enjoy what you're doing.....


Mike. :)

As long as it was working and doing what I wanted I never cared or thought about what was under the hood.

Nowadays I do consider what is under the hood due to all of the system resources being gobbled up by the browsers and necessary browser extensions.

Even using Puppy Linux the browsers and browser extensions use a lot of system resources.

People go out drink and have fun and spend loads of bucks per one day, why shouldn't we spend same bucks on our PC for similar fun of which will last for years for same cash.
I think this logic holds just fine.

Guilty Wife and I thought we were being watched when we went to the local pubs. :p
 
Thanks for sharing, I heard about swappiness but never learned about it, I've set mine to 5 because memory isn't an issue.
Is 5 too low?
Nope I don't think 5 is to low.

Lower the level number the less writes to the HDD or SSD.

I have my swappiness level set to 10.

If you have a lot of memory and are using an SSD I'd set my swappiness level to 1 so that it barely writes to the SSD.

I doubt that most users with 8.0 GB or more memory will ever see swappiness in use.

Even when I only had 4.0GB of memory I never reached anywhere close to running out of memory.

A lot depends on what you have on your workbench.
More amount of memory bigger workbench and no worries.
 
Last edited:
Depends what you run, 1 TB is also good
I'm just now using computers with 8.0GB of memory.

I can't even imagine having a computer with 32GB of memory.

What kind of a computer has 1TB of memory other than a server.
 
Some servers just have many slots so if you have 8 slots with 128 GB ...

But anyway, I would use the rule that if you often use more than 50% of the maximum memory you have, it's time to double.

For Windows, these days, the good base is 32GB

For Linux ... it depends, but you can do so much with 8GB, Unix is just more efficient in many ways
 

Staff online


Top