Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I work as a Java programmer, so I often have to run several programs at the same time that consume a lot of memory.

When my memory is full and Linux starts swapping, my computer almost completely freezes. I can see that it is heavily writing on the hard-disk and everything reacts really slowly, often not at all. Moving the mouse in X sometimes doesn’t work at all, sometimes it has a delay of several seconds, clicking usually has a delay of several minutes. Sometimes it is possible to change to the TTY (with a long delay), there I can usually type without delay, but when I try to log in, it takes several minutes after typing in the user name until the password prompt appears, and usually an error message appears that tells me that the login timed out. So the only possibility is usually to restart the computer.

I noticed that other intensive writing to the hard disk also significantly slows down my computer. Sometimes, I used rsync to limit the bandwidth when I copied files around on my own computer, as else the system would be almost unusable.

How can this be? At the moment it seems more useful to me to completely turn off swapping. That might crash some processes, which is unfortunate, but the alternative at the moment is to crash all processes by turning off my computer.

I am using Gentoo Linux with kernel 3.6.2-gentoo, I have a 10 GB swap partition on a HDD.

share|improve this question
1  
This is interesting. Linux doesn't start swapping when memory gets full, it gradually pages out more and more as memory fills up. See swappiness. Does it hit all at once, or is the slowdown a gradual thing? –  Darth Android Nov 2 '12 at 16:28
    
Do you know what disc you have in there and what SATA revision? I am curious if it's a bandwidth -or- disc limitation more than swap. –  nerdwaller Nov 2 '12 at 16:43
    
Note that the behaviour of gradually paging stuff out is to prevent exactly this kind of problem... tweaking swappiness can lead to really poor performance all at once. Not that Darth implied tweaking it, just an FYI, tweaking swappiness is not the answer. Finding the culprit with something like iotop guichaz.free.fr/iotop could help. –  mgjk Nov 2 '12 at 16:57
    
I had a similar issue in which a core i5 computer with 2gb of ram and a 2.5" low RPM drive that was almost useless when swapping. Ended up switching to a lower end machine with faster disks to solve the problem. –  ssmy Nov 2 '12 at 20:20
    
nerdwaller: lspci says 00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller (rev 06). hdparm says something about Gen1 signaling speed (1.5Gb/s), I can find nothing else that would say anything about the speed. –  cdauth Nov 5 '12 at 18:18
show 1 more comment

1 Answer

Swapping is a very bad thing for any UNIX/Linux system. As you have seen, it takes a serious resource involvement in supporting swapping especially for the disk system. Afterall, the system is moving memory back and forth to disk, so other programs using memory can run.

If after analyzing all the running programs in your system, and removing them, you are still swapping, then your best approach is to add more memory to your machine.

share|improve this answer
    
or to determine the cause before throwing more hardware at the problem. Which could be more to to slow IO than due to paging. –  Hennes Nov 2 '12 at 16:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.