Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

SWAP - Would You Swap It For Nothing?


  • This topic is locked This topic is locked
60 replies to this topic

#1 wizardfromoz

wizardfromoz

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:32 PM

Posted 25 January 2016 - 03:36 AM

Hi, Wizard here.

 

Background to this Topic can be found  at http://www.bleepingcomputer.com/forums/t/602849/my-ongoing-linuxubuntu-swap-issues/

 

... and its linked subjects, contained therein.

 

Thanks in advance to its OP Rocky Bennett, for his inquisitiveness and perseverance, in seeking to try and to implement suggestions he has been given in regard to satisfying his own perceived needs to employ Swap. If you see Rocky's avatar, and the posts he has up his sleeve, he is no stranger to this Site, but still getting a feel for Linux. That applies to many, myself included.

 

It is Rocky's Topic upon which I have drawn inspiration to start this one, so that I can both learn and teach. Thank you, Rocky.

 

In order to begin, I need a simple answer to a question I asked "over there".

 

#41 there refers - http://www.bleepingcomputer.com/forums/t/602849/my-ongoing-linuxubuntu-swap-issues/?p=3916817

 

... and I stated

 

 

The most swap I have seen in use, when I have it, is 4KB - forget on which Distro, I can check.

 

 

Al1000 then kindly provided a link, and contained with that was the following:

 

 

If you were looking at GParted, that could be a known bug that appears in some non-Gnome desktop distros.

 

So my question was to do with whether I could get a list a few of these non-Gnome desktop distros.

 

If I could get Al1000 to respond to that, I can then proceed, hopefully soon.

 

Stay tuned

 

:wizardball: Wizard



BC AdBot (Login to Remove)

 


#2 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,102 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:04:32 PM

Posted 25 January 2016 - 03:52 AM

 

non-Gnome desktop distros.

 

KDE is 1


Edited by NickAu, 25 January 2016 - 03:52 AM.

Arch Linux .
 
 Come join the fun, chat to Bleeping computer members and staff in real time on Discord.
 
The BleepingComputer Official Discord Chat Server!


#3 Al1000

Al1000

  • Global Moderator
  • 7,597 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:32 AM

Posted 25 January 2016 - 05:27 AM

So my question was to do with whether I could get a list a few of these non-Gnome desktop distros.


In addition to KDE that Nick mentioned, there's also LXDE and Xfce.
https://en.wikipedia.org/wiki/KDE
https://en.wikipedia.org/wiki/LXDE
https://en.wikipedia.org/wiki/Xfce

Edited by Al1000, 25 January 2016 - 05:28 AM.


#4 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,102 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:04:32 PM

Posted 25 January 2016 - 03:02 PM

Fluxbox

Enlightenment.

 

Try this.

http://bfy.tw/3ueX


Arch Linux .
 
 Come join the fun, chat to Bleeping computer members and staff in real time on Discord.
 
The BleepingComputer Official Discord Chat Server!


#5 Al1000

Al1000

  • Global Moderator
  • 7,597 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:32 AM

Posted 25 January 2016 - 05:28 PM

I'm waiting for Wiz to "enlighten" us as to where this thread is going. :)

#6 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,102 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:04:32 PM

Posted 25 January 2016 - 06:01 PM

I'm waiting for Wiz to "enlighten" us as to where this thread is going. :)

Me too I cant see the point of it.


Arch Linux .
 
 Come join the fun, chat to Bleeping computer members and staff in real time on Discord.
 
The BleepingComputer Official Discord Chat Server!


#7 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:32 PM

Posted 25 January 2016 - 06:54 PM

First of all, thanks ever so much to Al and Nick for their input, and I have just read Al's Post above. Keep practising those jokes, Al, lol.

 

You could also reference

 

https://en.wikipedia.org/wiki/Desktop_environment

 

... where amongst others, you could see examples of eg Cinnamon, MATE, Pantheon, Razor-qt, ROX, Window Maker and others.

 

Now MATE is a question mark. It is a fork from Gnome 2 ... is it Gnome or non-Gnome?

 

To give you an example - I had been studying my own environment, prior to reading Al's link to the Gnome commits at OSDir.com.

 

Illustrated below with two screenshots are GParted pictures from within Ubuntu 15.10 MATE 'Wily Werewolf', the first with swapon, the second with swapoff:

 

O7pU64P.png

 

 

and

 

 

lWwBtyh.png

 

Checking on a couple of other Distros revealed identical results, so I was coming to a conclusion that there might be an overhead to having swap on, amounting to 4.00KiB. This appears to be corroborated by the article Al referenced.

 

 

I'm waiting for Wiz to "enlighten" us as to where this thread is going. :)

 

Where am I going? As any number of you know by now, I like to provide Users with alternatives to best suit their needs. I myself am an advocate for no swap, as is Nick, but in both cases, we are talking about having 8GB or more RAM available to us - I have 8GB on the Toshiba and the old Acer AIO, 16GB on the Asus, &c. Elaine's old laptop only has 512MB RAM and a 60 (could be 80) GB HDD. 4GB of swap on that unit can mean the difference between my installing or not installing another Linux on it (runs LXLE 32-bit and Peach OSI BB 32-bit currently).

 

Currently I have 15 Linux Distros running on 3 machines, so you may have to exercise a little patience as I try them out, for my research.

 

I will also be adding before this weekend, to the Toshiba shown above - RoboLinux and Mageia. Mageia 15.10 I have used before and reviewed, it goes into a sulk if it does not have a /Home and a /swap, but I will look for a workaround. Mageia being RPM-based is important for my research, as is Sabayon already on (Gentoo-based), and Manjaro (Arch-based).

 

You will note from the screenshots that between installing Manjaro and installing MX-15 Fusion that I enabled an 8GB swap. This was to see if it allowed Wily Werewolf to boot up faster, and it does. I also know from experience that Mageia has a slow startup without swap.

 

Of the 10 Distros installed on the Toshiba currently, only Ubuntu (MATE - Nick may have input on Unity) is affected by the presence or absence of swap, and that is always at startup, and often at reboot or shutdown. None of the 10 is affected in any discernible way during the session they are running and that can include having (on one occasion) over 120 Tabs open in Firefox, and extensive multi-tasking simultaneously.

 

My disclaimer here, as mentioned elsewhere is that I do not run memory-intensive procedures such as video-editing or music-editing, Google Earth, and only the occasional VM (the latter on Zorin OS9 on the Acer).

 

Where am I going? Again. It is not "the scientific method" to set out to prove that you don't need swap, rather I am exploring the boundaries of where you DON'T need it, and where you MIGHT.

 

Bear in mind the outcomes here may help Users to choose in a more educated fashion, the Distro that might best suit their needs.

 

I will also be showing you at least two (2) methods of "having your cake and eating it" - with swap generated WITHOUT a dedicated Partition - "on the fly" so to speak, as the need arises, and which is eliminated once the need is no longer there.

 

One of these is a method which is equipment-friendly with flash-based storage devices, in particular solid state drives (SSDs). Nick, Cat and others may likely have an interest in that subject.

 

So stay tuned, plenty more to come, and as always I welcome the input.

 

:wizardball: Wizard

Happy Australia Day to all Aussies! (26th January)

 

BTW - hope you can see the point NOW, Nick?

 

Edited - added BTW


Edited by wizardfromoz, 25 January 2016 - 06:56 PM.


#8 pcpunk

pcpunk

  • Members
  • 5,759 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:02:32 AM

Posted 25 January 2016 - 07:07 PM

Maybe I can bring it to life lol.  I have 2GB of swap now, and 4gb of RAM.  I never see swap being used and my system is not good enough to run a VM.  The only time I have seen swap being used is when my system was crashing, can someone suggest if swap is needed during this time or not.

 

JvMGfUv.png


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#9 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,102 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:04:32 PM

Posted 25 January 2016 - 07:16 PM

Why is your PC using so much ram? You are using 2.9GiB ram? and 900 MiB of swap that is not normal.


Arch Linux .
 
 Come join the fun, chat to Bleeping computer members and staff in real time on Discord.
 
The BleepingComputer Official Discord Chat Server!


#10 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:32 PM

Posted 25 January 2016 - 07:20 PM

Is that shot from the time of a crash, friend punk?

 

:wizardball:



#11 pcpunk

pcpunk

  • Members
  • 5,759 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:02:32 AM

Posted 25 January 2016 - 07:24 PM

Yes, some kind of crash - but I'm not smart enough to read any crash reports.  All is good now though.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#12 Al1000

Al1000

  • Global Moderator
  • 7,597 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:07:32 AM

Posted 25 January 2016 - 07:55 PM

You could also reference


No need now that you've done it. :)

Where am I going? As any number of you know by now, I like to provide Users with alternatives to best suit their needs. I myself am an advocate for no swap...

Where am I going? Again. It is not "the scientific method" to set out to prove that you don't need swap, rather I am exploring the boundaries of where you DON'T need it, and where you MIGHT.

What I mean is, where are you going with this list of non-Gnome distros, and why did you ask me to list some when you could have done so yourself?

#13 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,102 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:04:32 PM

Posted 25 January 2016 - 08:00 PM

 

Bear in mind the outcomes here may help Users to choose in a more educated fashion, the Distro that might best suit their needs.

 

This i want to see, People are going select a distro based on swap?

 

 

How Linux uses RAM (very simplified)

Each application can use some of your memory. Linux uses all otherwise unoccupied memory (except for the last few Mb) as "cache". This includes the page cache, inode caches, etc. This is a good thing - it helps speed things up heaps. Both writing to disk and reading from disk can be sped up immensely by cache.

Ideally, you have enough memory for all your applications, and you still have several hundred Mb left for cache. In this situation, as long as your applications don't increase their memory use and the system isn't putting too much pressure on the cache, there is no need for any swap.

Once applications claim more RAM, it simply goes into some of the space that was used by cache, shrinking the cache. De-allocating cache is cheap and easy enough that it is simply done in real time - everything that sits in the cache is either just a second copy of something that's already on disk, so can just be deallocated instantly, or it's something that we would have had to flush to disk within the next few seconds anyway, thus there is zero performance hit in re-allocating cache to applications.

So, when someone refers to "free" RAM, this may or may not include cache, since cache will only occupy "free" RAM. This is not a situation that is specific to Linux - all modern operating systems work this way. The different operating systems might just report free RAM differently: some include the cache as part of what they consider "free" and some may not.

When you talk about free RAM, it's a lot more meaningful to include cache, because it practically is free - it's available should any application request it. On Linux, the free command reports it both ways - the first line includes cache in the used RAM column, and the second line includes cache (and buffers) in the free column.

How Linux uses swap (even more simplified)

Once you have used up enough memory that there is not enough left for a smooth-running cache, Linux may re-allocate some unused application memory from RAM to swap in order to regain some memory for cache.

It doesn't do this according to a definite cutoff though. It's not like you reach a certain percentage of allocation then Linux starts swapping. It has a rather "fuzzy" algorithm. It takes a lot of things into account, which can best be described by "how much pressure is there for memory allocation". If there is a lot of "pressure" to allocate new memory, then it will increase the chances some will be swapped to make more room. If there is less "pressure" then it will decrease these chances.

Your system has a "swappiness" setting which helps you tweak how this "pressure" is calculated. It's normally not recommended to alter this at all, and I would certainly never recommend you alter it. Swapping is overall a very good thing - any occasional performance penalties are intended to be offset by a gain in overall system responsiveness and stability for a wide range of tasks. If you reduce the swappiness, you let the amount of cache memory shrink a little bit more than it would otherwise, even when it may really be useful. You therefore risk slowing down your computer in general, because there is less cache, while memory is being taken up by applications that aren't even using it. Whether this is a good enough trade-off for whatever specific problem you're having with swapping is up to you. If you go further than this and actually disable swapping, you risk system instability in the event that the system runs out of memory for processes.

https://askubuntu.com/questions/184217/why-most-people-recommend-to-reduce-swappiness-to-10-20

 

 

 

I am exploring the boundaries of where you DON'T need it

If you have a machine with under 2 GiB of ram you need it, If you have a machine with 8 GiB of ram or more you don't


Edited by NickAu, 25 January 2016 - 08:16 PM.

Arch Linux .
 
 Come join the fun, chat to Bleeping computer members and staff in real time on Discord.
 
The BleepingComputer Official Discord Chat Server!


#14 Guest_hollowface_*

Guest_hollowface_*

  • Guests
  • OFFLINE
  •  

Posted 25 January 2016 - 11:44 PM

@wiz

Interesting thread, look forward to watching it progress.

 

@all

Deciding not to have swap is an optimization. In order to make optimizations that don't hurt you, one needs to be knowledgable enough to determine what their needs are based on their usage. The average Linux home user with a new-ish machine will likely have usage patterns and RAM quantities that mean they don't need swap. If a user is unsure whether their usage demands swap or not, I think the best course of action is to setup swap, then disable it. This way the user can see how close they are to needing it, and make an informed decision.

Personally, regardless of RAM quantity (my main computer has 8GiB), if I'm installing to a harddrive, I prefer to setup a large swap partition (10GiB usually), just incase. Since I can spare the space, why not. If I'm installing to an SSD then I prefer not to.

 

wfCtWpj.png

 



#15 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male

Posted 26 January 2016 - 12:29 AM

@hollowface:

 

 

If a user is unsure whether their usage demands swap or not, I think the best course of action is to setup swap, then disable it.

 

I can see you have already got an idea of where I am headed with this Topic. Goodonyer.

 

10GiB? Interesting, not something I would do, but if it ain't broke don't fix it. Tempting to ask what is your swappiness, but I am not sure if that is going off-topic in my own Topic? I don't think so. They are intimately related.

 

I, like you, have space to burn. I have in excess of eight and a half TiB, and so can install as many Distros as I like, and see how they perform with or without Swap.

 

Thanks for your interest, and I'll be back with more soon.

 

:wizardball: Wizard






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users