LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-25-2007, 01:12 AM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Diskless machine vs swap space


For a machine that requires a very large amount of physical memory (e.g. 4 or 8 GB and up) and that is diskless, is it going to be a big problem?

I ask because if it's diskless, obviously you cannot have any swap space. What are the implications of no swap space on something with so much memory - in fact, on any machine, for that matter?

In general terms, would it be better to forgo the benefits of a diskless server (e.g. maintenance, expense) and just purchase a disk to act as a swap drive, or is it ok to avoid the disk?

After all, isn't swapping a 'bad' thing? So if your server is about to swap, then you know its time to either add more memory or more machines? Or would adding more physical memory every time a machine would have swapped to disk be a recipe for bankruptcy?
 
Old 07-25-2007, 08:45 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Swap is essentially emergency memory; a space set aside for times when your system temporarily needs more physical memory than you have available in RAM. It's considered "bad" in the sense that it's slow and inefficient, and if your system constantly needs to use swap then it obviously doesn't have enough memory. But if it only happens occasionally then there's no problem. That's its purpose, after all.

If you have enough RAM to handle all of your needs, and don't expect to ever max it out, then you should be perfectly safe running without a swap space. But if you ever do max out then you'll simply suffer from whatever symptoms the system normally suffers when memory is low, and that depends on how everything is programmed. Now I don't know for sure how Linux (the kernel) handles low memory situations but I can guess that at the very least it will try to fail gracefully, and that goes for most well-written programs as well. I imagine you still might run the risk of system freezes though, where there simply isn't enough memory available for even the most basic of functions.

Do note that exactly the same thing will happen if you DO have a swap space and go beyond your total RAM+swap allocation.

So long story short, swap is designed for occasional "overflow" use. If you have constant low-memory problems, you should get more RAM.
 
Old 07-25-2007, 08:49 AM   #3
nakedlunch
LQ Newbie
 
Registered: May 2007
Location: Memphis
Distribution: Slackware 12.0
Posts: 18

Rep: Reputation: 0
I'm pretty sure you can get by without swap space, especially if you're running that much physical memory. That said, swap and physical RAM work somewhat differently as far as how they handle memory usage. It might be something to look into depending on the particular needs of your system. You could always throw an old drive in there allocated solely to swap, if nothing else.

Hope that helps

Last edited by nakedlunch; 07-25-2007 at 08:50 AM.
 
Old 01-14-2018, 09:45 PM   #4
markhahn
LQ Newbie
 
Registered: Jan 2011
Posts: 16

Rep: Reputation: 4
A little swap is a good thing

It is absolutely and clearly false that you should aim your configuration at no swap. A little swap is a good thing - any system will have some pages that are so cold and idle that they don't "deserve" to be in RAM. Having those on disk (swapped out) is only of benefit to you.

In general, swap OUT is good for you. What you want to avoid is swap IN. Swapping in means that something is actually waiting on pages that the kernel thought were cold/useless. Or that you've pushed your system so far past your amount of RAM that you're thrashing (which just means "inefficient because of so much waiting on swapins").

These days, systems often have SSD, which is far more effective in supporting swap than HDs ever were. A modest amount of swapins, from SSD, definitely won't hurt you, since they're about 100x lower latency than from HD. This is a bit of a crutch, to be sure, but can extend the lifespan of a low-memory laptop, for instance. Remember to TRIM your SSD periodically, though.
 
Old 01-15-2018, 05:25 AM   #5
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,493

Rep: Reputation: Disabled
Always better to have than to need swap.

I'd be tempted to add a small SSD for swap, just in case.
 
Old 01-15-2018, 08:38 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
You can also provide for swapping to a "swap file" if you have one.

I share the general notion that swap-space is a good idea to give the machine somewhere to "park" stuff.

But, these days, sometimes a computer "just has so damned much RAM available" that it will never run out of that resource doing whatever it's tasked to do.

The problem is, if the computer has no means to swap, it has to bring out the dreaded "OOM Killer." (He's the system process with the black robes and the scythe ...) As we all know, Mortis will get the job done, but he can be very indiscriminate.
 
Old 01-15-2018, 01:16 PM   #7
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
i?e been running myh system with no swap for a few years no and not had any issues. I can run the latest gams (well, such as Linux allows) and have VMs going but still not use all my RAM.
swap is used for either emergency situations where you see it filling then kill a process or where you can't afford RAM.
I refer to desktop use above -- for servers it's similar but money comes into it too.
 
Old 01-15-2018, 05:10 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by 273 View Post
swap is used for either emergency situations where you see it filling then kill a process or where you can't afford RAM.
If Linux has swap space available, it will sometimes "swap out" processes that aren't doing anything – of which there are sometimes a great many.
 
Old 01-15-2018, 05:39 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
If you wish to run a diskless system, do so. If I had such and wanted to see if swap was necessary I'd allocate some zram - that's compressed swap in RAM, all managed by the system.
Keep an eye on it, and if never used you could even delete it and reclaim the RAM. Personally I'd probably keep it.
 
Old 01-16-2018, 12:48 AM   #10
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by sundialsvcs View Post
If Linux has swap space available, it will sometimes "swap out" processes that aren't doing anything – of which there are sometimes a great many.
When a system has relatively little RAM, yes, but even on my low-RAM system I see this only minimally and it's largely pointless as there's still RAM to spare. I can see servers getting the benefit if they're using all the RAM for cache, for example, but I've never seen a situation on a desktop where it makes sense.
 
Old 01-16-2018, 03:09 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
markhahn, this was an 11 year old post.
We usually try to avoid adding to such old information.
The original question was a diskless system.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reduce swap space and reclaim the space grantm Linux - Newbie 7 08-16-2012 07:05 AM
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 03:20 AM
Machine Doesnt boot, gets to swap space ok then hangs Redhat leesmith110 Linux - Enterprise 2 04-28-2006 06:55 AM
Samba share over diskless machine... amitsharma_26 Linux - Software 1 09-29-2005 09:30 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration