1 |
>> So swap isn't treated exactly like RAM. It actually has special |
2 |
>> handling in Linux which makes it beneficial to have on almost any |
3 |
>> Linux system? According to Alan, things get very bad when a Linux |
4 |
>> system hits swap. How can behavior like this be beneficial: |
5 |
>> |
6 |
>> "When a linux machine hits swap, it does so very aggressively, there |
7 |
>> is nothing nice about it at all. The entire machine slows to a |
8 |
>> painstaking crawl for easily a minute at a time while the kernel |
9 |
>> writes pages out to disk, and disk is thousands of times slower than |
10 |
>> RAM. |
11 |
>> |
12 |
> This is not entirely true. There's regular swapping and there is |
13 |
> "thrashing". Thrashing is indicative of a memory-starved system, i.e. |
14 |
> when many processes are trying to access memory, but there just isn't |
15 |
> enough and the system is frantically swapping in/out. I'm talking about |
16 |
> your normal day-to-day swapping that you probably don't even notice. |
17 |
> |
18 |
>> It gets so bad that you can't even run a shell properly to try and see |
19 |
>> what's going on and kill the actual memory hog." |
20 |
> |
21 |
> Again, that is thrashing. I'm talking about "normal" swappage. Dont |
22 |
> throw the baby out with the bath water. |
23 |
> |
24 |
>> Also, aren't you likely to wear out your hard disk sooner using swap? |
25 |
> |
26 |
> Is this coming from someone who uses Gentoo linux, which is constantly |
27 |
> downloading/compiling/linking object files? Syslog and other loggers |
28 |
> writing everything under the sun to a log file. Backups, journal |
29 |
> writes, database transactions, etc. Compare how many disk transactions |
30 |
> take place during your normal Gentoo usage versus a few megabytes |
31 |
> here/there being swapped in/out. Again, I'm talking about regular |
32 |
> swapping, not "oh my god I has no RAM and my hard drive won't stop" |
33 |
> Even so, we're talking about modern drives here. This isn't the 1960s. |
34 |
|
35 |
If I understand correctly, an out-of-memory condition that would lock |
36 |
up a system without swap, will cause it to thrash with swap. A remote |
37 |
system of mine was locked up for many hours due to running out of |
38 |
memory without swap. If I had enabled swap, the system would have |
39 |
thrashed for those hours? |
40 |
|
41 |
- Grant |