Ok. Up today we all used swap I believe in our systems.
But with todays servers do we still need swap ?
For example apart from 1 all my other servers have 4+ gigabyte ram.
I've googled alot and read tons of different opinions. And also OS communities don't give a clear image of if you need or if you dont need swap. And when they say you need swap they only discuss about a machine that has up to 2 giga ram.
So ...
Would you setup swap on a server with 4 gb ram for example ?
And if yes why ?
swap discussion
swap discussion
Hello IT.
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego
-
- Atomicorp Staff - Site Admin
- Posts: 8355
- Joined: Wed Dec 31, 1969 8:00 pm
- Location: earth
- Contact:
Re: swap discussion
Yes you need swap, if only to manage some garbage collection on the system. I generally use at least an equal amount of swap to the ram on the system, but as you get to higher and higher amounts this becomes less and less important. More modern kernels also allow you to set the "swapiness" of the system from /etc/sysctl.conf with: vm.swappiness=X, where X is a value 0-100 (default is 60) that determines the swap policy on the system. 0 meaning swap only when you need memory, and 100 being swap out as many unused pages as possible to free up memory.
Re: swap discussion
Do you need swap? Yes. Without swap you could have bad things happen. How bad? Well, consider the comic on this page, except that malloc might not be so nice. Swap exists so you can pretend you have more RAM than you have. The cost is performance. Your hard drive is a snail compared to RAM's souped-up motorcycle, so storing RAM to disk is not the best idea but trying to allocate RAM and having your memory manager go "Sorry, all out" could cause mayhem (I don't know exactly what would happen under Linux but why taunt happy fun ball when you don't need to?).
In a normal Linux system, you run pretty close to full usage for performance reasons (being that RAM is so fast and usually abundant). Your virtual memory manager will offload less used blocks of memory to make room for other things that need it short term. This keeps your RAM fresh without needing to destroy anything. A small amount of swap usage is to be expected on any machine.
I would say 512MB - 1GB of swap should be more than sufficient for most systems. A full swap means you've got problems.
In a normal Linux system, you run pretty close to full usage for performance reasons (being that RAM is so fast and usually abundant). Your virtual memory manager will offload less used blocks of memory to make room for other things that need it short term. This keeps your RAM fresh without needing to destroy anything. A small amount of swap usage is to be expected on any machine.
I would say 512MB - 1GB of swap should be more than sufficient for most systems. A full swap means you've got problems.
"Its not a mac. I run linux... I'm actually cool." - scott