Why Swap

hello guys , please help , i install manjaro 18.0.3 today , without SWAP , my pc works well , i need swap ?

You need swipe if you want using Hibernate mode for example. If you have 8 or more RAM and won't use hibernate, it's not necessarily to have swap

3 Likes

i have 4 gb ram but i never used pc hibernation

you can watch your system couple days, if it will enough memory for your general usage (it depends how many application you keep open for example) then leave as is.
If no, later you can create swap file.

1 Like

okay bro thanks .

while I guess it is not necessary I don't really see a reason not to have it. hard disk space is cheaper than ram space(price per gig) so it is a way to give your self a little more head room for ram (just set your swappiness lower than default so it doesn't start writing it before it needs to) . At the same time if you have enough ram and never go close to maxing it out then its not that big of a deal. At 4gb I think I would want some since 4gb is on the low side for most modern systems these days.

I have only 4GB RAM on two different machines running Manjaro. I have never seen my swap being used. However, I do not do RAM intensive stuff such as: video, photo or audio editing, gaming, CAD, virtual machines, etc. Nor do I rarely have say more about 10 tabs open at any one time on my browser. So YMMV.

Even if your system attempts to use swap and you don't have it the system will close down the least used process to get you the RAM you need.

I have it set up the default way on my laptop with 4gb of ram as well and really don't see it get used much either but I mean unless you are really constrained for hard drive space (like if you have one of those small ssd like on say a chrome book I guess I could see an issue) I don't see much benefit in not having it is all I was getting at.

It used to be the case that the kernel would perform better with a little bit of swap available. I don't know if that's changed. You may also encounter a rare piece of software that expects swap space and will misbehave without it.

Force of habit always makes me add swap no matter how much RAM the computer has. I also set the swappiness to 5 so it's only used if absolutely necessary.

1 Like

You can also use zram (without swap partition/file)

Zram is a hoax. I use it and I don't see any effects. It is on, works correctly but... RAM usage is similar. If it does compress some files in RAM, it's maybe about 5-15% and hardly noticeable.
The same is with zswap. The effect is only cosmetic at best.

Are you guys for real? Or maybe you are using 32bit systems? It only takes to launch two browsers and a Thunderbird, have lot's of cards in a browser, lots of media content - 4GB is laughably small. Have one Firefox instance opened and I'm already using 2GB of RAM. It's easy to use the rest 2GB...

8GB is another story, this gives you room to breathe but with intense browser usage or virtual machines running this can be too little as well. Compiling of heavy programs also can need at least 8GB and sometimes it's not even enough.
Funny thing, games seem not to be so RAM heavy. With Witcher 3 on Ultra settings I saw max 4-5GB used RAM (with system of course).

Are you a developer? zram/zswap is included in Linux kernel long time ago, so it is definatelly no HOAX. Maybe I have the wrong impression of what HOAX means..

You are not supposed to see the difference unless you use proper debugging/commands.

Anyway, a system can work without swap and my suggestion was to cover this

1 Like

Actually ZRAM does work and its benefits are most often seen on systems with low RAM. So in the instance of a 4GB RAM machine perceptible benefits should be had.

2 Likes

ZRAM is really for folks who have like less than 1GB of ram. Its kinda similar to SWAP and kinda similar to 'virtual memory' of windoze. If you have anything much more than that you probably wouldnt notice any difference. Probably not positively anyways.
It was never "OMG GIVE ME EXTRA RAM BY MAGIC" .. it was always 'how do we do something kinda smart and make the best of what we have'.

As to SWAP in general .. yes you need it. Unless you have 32GB of RAM and it never fills half-way .. you need it. "Need" can be funny here ... but once your memory gets kinda full, you will realize you 'need' it.

Without SWAP, if your RAM gets full .. you lock up. Thats it.

2 Likes

Maybe my words were over-aggregated, what I meant is that the documentation or articles on zram suggest as if it was creating a huge effect while in reality it's just cosmetics. It may be working on some type of data but in real life usage it's very likely to have data that isn't much smaller after compression so the results aren't much noticeable.

I use it on my laptop with 4GB RAM and I'm not happy about it. I must be careful what I run to avoid swap, because on slow HDD this means freeze for a long time. 4GB RAM will handle Firefox and Thunderbird but not the second browser, so when I accidentally open one, I'm closing it in panic because I see instantly HDD working and system responsiveness slowing down. If I react soon enough, I can lose half a minute, if not, the freeze occurs for a long moment.
4GB RAM is painfully little, at least for what I need and this old laptop is very limiting.

With new laptop with SSD I just added swap file, made it dynamic so it increases when I need it and it works perfectly - just as with windows virtual memory. So I can throw anything at it and only root available space is the limiting factor. SSD is quick enough that it works as well as RAM itself or at least I don't see much difference. HDD on the other side, especially crappy, laptop ones is a different story. If it uses swap, it's not usable at all, so in reality, I must be aware of what I run to not to go overboard.

Then the articles you read were a hoax. That is not ZRAMs purpose. It is not 'cosmetic' .. it is quite practical for a certain set of instances. Please see above :arrow_heading_up:

1 Like

OK, maybe I'm remembering it wrong, but the effect was to lower how much space data uses on RAM?

Yeah .. its functionally compressed memory. Not useful for anything but under-RAM'd machines.

I just had a look at the ArchWiki which seems surprisingly .. dated [it even mentions zram as a way to reduce SSD wear by accessing the disk less].

But even there they make good note of draw-backs of using it. [extra cpu, etc]

4gb is quite common even on brand new low end laptops. that being said my laptop is a little on the old side being as I bought it second hand at a pawnshop 4 years ago. That being said I don't really need it to be a big power house as I have a pretty powerful desktop with plenty of ram and such.

Which is why an SSD is probably the most economical performance booster you can add to an old laptop, with limited RAM.

3 Likes

Forum kindly sponsored by