|
List Info
Thread: Is swap need when there is 4g of ram?
|
|
| Is swap need when there is 4g of ram? |
  Singapore |
2007-03-13 04:09:06 |
Hi,
Is swap really needed when there is a 4g of ram?
P.V.Anthony
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |
  Germany |
2007-03-13 04:56:01 |
On Dienstag, 13. März 2007, P.V.Anthony wrote:
> Hi,
>
> Is swap really needed when there is a 4g of ram?
depends ;)
but you don't need a swap partition. A swapfile is good
enough and more
flexible.
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |

|
2007-03-13 07:46:39 |
My 50 cents:
A swap partition is always faster than a swap file. Not so
much, but is faster.
With 4GB of RAM is expected to find computers with lof of
free space in hard
disk. So: creating a 4GB of swap in a partition will give us
a extra
resource with
little cust.
Anthony is really right: it depends if you need swap. In a
server with
30 users,
problably not, even in the case where the access is
simultaneous (by experience
with servers with 2GB of RAM and 2GB of swap).
But, in a desktop, it depends of applications running at the
same time. I have
4 GB of RAM, and when emerging some large programs, I mount
some part of
memory (3GB) in /var/tmp/portage (using tmpfs). This
acelerates the emerging
process, and the only program I can't compile in this way is
openoffice :(.
When I'm using memory as a space to compile programs, the
swap is used
in some moments, if I'm using firefox (with 2 windows of 10
tabs each) and
openoffice.
So, in normal use, you probably don't need a swap. But, It
will hurts in terms
of disk space to create it? Probably not, so create and be
prepared to large
requests of memory . This is
my sugestion...
2007/3/13, Hemmann, Volker Armin
<volker.armin.hemmann tu-clausthal.de>:
> On Dienstag, 13. März 2007, P.V.Anthony wrote:
> > Hi,
> >
> > Is swap really needed when there is a 4g of ram?
>
> depends ;)
>
> but you don't need a swap partition. A swapfile is good
enough and more
> flexible.
> --
> gentoo-amd64 gentoo.org mailing list
>
>
--
[]s
Joaquim
------------------------------------------
(o_ Joaquim Quinteiro Uchoa
// Consultor Linux e EaD
U_/_ Linux User # 100534
------------------------------------------
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |
  United States |
2007-03-13 09:11:00 |
On Tue, Mar 13, 2007 at 09:46:39AM -0300, Joaquim Quinteiro
Uchoa wrote:
> Anthony is really right: it depends if you need swap.
In a server with
> 30 users,
> problably not, even in the case where the access is
simultaneous (by experience
> with servers with 2GB of RAM and 2GB of swap).
One of the benefits of swap is that unused application text,
data, etc.
can be paged out in a fairly permanent fashion. Without
swap, that
stuff has to sit in RAM, even if it's not touched for hours
or days.
I'm not sure if your load is such that the savings will be a
significant
portion of 4G.
Dustin
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |

|
2007-03-13 09:28:28 |
Ok, new swapfiles are acessed as block, bypassing the
filesystem:
http://lkml.org/lkm
l/2005/7/7/326
In this way, with physical access, really doesn't matter if
is a
partition or a swapfile...
In this situation, a swap partition is only more easy to
manage (You
don't need to
create the file after the instalation proccess) and can be
shared by
several SOs in a
same computer. But swapfiles can be more flexible (you can
expand and move more
easily).
I think I will prefer swapfiles in future instalations
2007/3/13, Hemmann, Volker Armin
<volker.armin.hemmann tu-clausthal.de>:
> On Dienstag, 13. März 2007, Joaquim Quinteiro Uchoa
wrote:
> > My 50 cents:
> >
> > A swap partition is always faster than a swap
file. Not so much, but is
> > faster.
>
> nope. That was only true for 2.2 and 2.4 kernels. One
of the features of 2.6
> is that swapfiles are not slower anymore.
>
> --
> gentoo-amd64 gentoo.org mailing list
>
>
--
[]s
Joaquim
------------------------------------------
(o_ Joaquim Quinteiro Uchoa
// Consultor Linux e EaD
U_/_ Linux User # 100534
------------------------------------------
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |
  Germany |
2007-03-13 09:32:45 |
On Dienstag, 13. März 2007, dustin v.igoro.us wrote:
> On Tue, Mar 13, 2007 at 09:46:39AM -0300, Joaquim
Quinteiro Uchoa wrote:
> > Anthony is really right: it depends if you need
swap. In a server with
> > 30 users,
> > problably not, even in the case where the access
is simultaneous (by
> > experience with servers with 2GB of RAM and 2GB of
swap).
>
> One of the benefits of swap is that unused application
text, data, etc.
> can be paged out in a fairly permanent fashion.
Without swap, that
> stuff has to sit in RAM, even if it's not touched for
hours or days.
>
no it has not to stay in ram. Unused stuff that is not
'dirty' IE identical to
the stuff on harddisk, can be kicked out of ram, when the
space is needed.
And for some funny reason, loading something out of swap is
much slower than
loading it from the fs....
50mb in swap - and everything is slow. So slow as if every
bit is fetched by a
mule caravan. And it does not matter if it is a swap
partition or a swap
file. It is slow.
But there is an easy way to get the box back to normal
speed: swapoff -a &&
swapon -a ...
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |
  Germany |
2007-03-13 09:35:31 |
On Dienstag, 13. März 2007, Joaquim Quinteiro Uchoa wrote:
> Ok, new swapfiles are acessed as block, bypassing the
filesystem:
>
> http://lkml.org/lkm
l/2005/7/7/326
>
> In this way, with physical access, really doesn't
matter if is a
> partition or a swapfile...
>
> In this situation, a swap partition is only more easy
to manage (You
> don't need to
> create the file after the instalation proccess) and can
be shared by
> several SOs in a
> same computer. But swapfiles can be more flexible (you
can expand and move
> more easily).
>
> I think I will prefer swapfiles in future instalations
>
I have a (small) swap partition, and a big 'emergeny'
swapfile - that is
hardly ever used.
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |
  United Kingdom |
2007-03-13 13:04:08 |
On Tuesday 13 March 2007 09:09:06 P.V.Anthony wrote:
>
> Is swap really needed when there is a 4g of ram?
Yes.
That assumes that you will be compiling lots of large
programs such as
mozilla-firefox and Open Office. Let me tell you about my
case:
I have 4 GB RAM and 2 x Opteron 246 CPUs, and I have three
2GB swap
parttions: one each on 2 x IDE and 1 x SATA disks. I've told
portage to use
the /tmp directory for its work, and /tmp is mounted on
tmpfs with a size
of 6.5 GB. If /tmp occupancy outgrows the physical RAM, the
kernel swaps
part of it out to disk and carries on. Magic!
I run top in an X terminal when I want to monitor swap use.
It shows me that
the only time the swap gets used is when I'm compiling one
of those large
packages. Open Office, in particular, uses up to 5.7 GB of
temporary space
on my box, which is why I've set the /tmp limit to 6.5 GB.
It may actually
use more, but that's the most I've observed.
This box also spends nearly all its cycles on BOINC projects
(http://boinc.berkeley.edu/
), which not only ramps up the temp and noise,
but of course uses a fair amount of space. All the same, I
still don't see
any use of swap except on those prodigious compiling jobs.
So, if you don't intend to compile large packages, you
probably don't need
swap; if you do, you do.
HTH.
--
Rgds
Peter Humphrey
Linux Counter 5290, Aug 93
--
gentoo-amd64 gentoo.org mailing list
|
|
| Re: Is swap need when there is 4g of
ram? |
  United States |
2007-03-13 15:24:10 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hemmann, Volker Armin wrote:
> And for some funny reason, loading something out of
swap is much slower than
> loading it from the fs....
That seems odd. if you're talking about executables and
other MMAP'ed
objects the filesystem IS the swap (when apache needs to be
swapped out
the kernel just deletes it from memory and reloads from disk
- unless
the executable pages were modified - not sure how dynamic
linking is
handled in linux, and if that needs to modify code pages).
Unless of course your swap is encrypted or something it
should be faster
than the FS...
>
> 50mb in swap - and everything is slow. So slow as if
every bit is fetched by a
> mule caravan. And it does not matter if it is a swap
partition or a swap
> file. It is slow.
>
I haven't seen this behavior - I routinely have maybe 500MB
swapped out.
The difference is that most of this is probably tmpfs data
that isn't
touched until tmpreaper comes around and deletes it.
The critical factor is probably RSS - if you have a zombie
process that
uses 1GB of RAM and which sleeps for 3 days at a time (with
NO activity)
then if you swap it out there is probably no impact. On the
other hand,
if you have 50 processes all running with 2%CPU each and
they each have
a 100MB RSS and you have 1GB of RAM your system will come to
a complete
halt. Even if all combined they only need 1.1GB of RAM
you'll probably
still come to a halt since they'll be constantly churning
that 100MB of
swap. If 100MB worth of processes sleep suddenly the whole
system will
wake up.
Basically, there is no fix for lots of RUNNING processes
other than more
RAM (or not running everything at once). But lots of idle
processes do
just fine with swap.
And not having a swap partition doesn't stop swapping. Any
time you
mmap a file you have virtual memory - no getting around it.
And that
data will get swapped in and out as needed. And even if
none of your
software uses mmap the kernel does every time it loads an
image. It
greatly improves performance (unused code never gets
loaded).
If I'm wrong on any of this kindly point it out, but this is
my
understanding of how linux swapping works.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF9whqG4/rWKZmVWkRAr0EAJ440jI6WPQO3dR9ldn6lYVYTb2WkwCf
RgFT
sPEuMMbiyY4k1MtFn2nHEWI=
=dBn2
-----END PGP SIGNATURE-----
|
|
| Re: Is swap need when there is 4g of
ram? |
  United States |
2007-03-14 09:19:59 |
On Tue, Mar 13, 2007 at 03:32:45PM +0100, Hemmann, Volker
Armin wrote:
> 50mb in swap - and everything is slow. So slow as if
every bit is fetched by a
> mule caravan. And it does not matter if it is a swap
partition or a swap
> file. It is slow.
>
> But there is an easy way to get the box back to normal
speed: swapoff -a &&
> swapon -a ...
Perhaps better to tweak the VM so it is not as swap-happy
using
/proc/sys/vm/swappiness. See http://kerneltrap.org
/node/1044
--
gentoo-amd64 gentoo.org mailing list
|
|
|
|