-----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/rWKZmVWkRAr0EAJ440jI6WPQO3dR9ldn6lYVYTb2WkwCfRgFT
sPEuMMbiyY4k1MtFn2nHEWI=
=dBn2
-----END PGP SIGNATURE-----

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to