1 |
Grant wrote: |
2 |
|
3 |
>>Swap enables the system to have more memory pages for the running processes. If |
4 |
>>the OS doesn't have enough memory for a process, it'll let the process know, or |
5 |
>>simply kill it. |
6 |
>> |
7 |
>>If you don't want swap to be used, disable it. Remember that the system also |
8 |
>>uses physical ram for caching disk, not only for user processes. |
9 |
>> |
10 |
>>If you don't use swap, your 'inactive' processes won't go into swap. Maybe the |
11 |
>>OS prefers having more disk into cache than a process in physical ram. (there |
12 |
>>must be rules in Linux for that). Then, when your usually-inactive process is |
13 |
>>awakened, the OS must move its pages from disk to RAM, shown as a slow answer |
14 |
>>from that process. |
15 |
>> |
16 |
>>Reaching your memory limit without swap, is the same as reaching the memory |
17 |
>>limit with swap (physical + disk). Someone who maintains a system, must select a |
18 |
>>reasonable amount of 'swap' according to the expected behaviour of that system. |
19 |
>>What do you want, be able of running more processes than your physical RAM |
20 |
>>enables -use swap- against some slowness, or keep on your physical RAM limit, |
21 |
>>keeping a normal system speed for all processes? |
22 |
>> |
23 |
>>conclusion: you're absolutely free for disabling your swap. System doesn't |
24 |
>>require swap for "some reason", as you said. |
25 |
>> |
26 |
>> |
27 |
> |
28 |
>OK, I'm getting a better grip on memory and swap thanks to you guys. |
29 |
>Let me ask this another way though. |
30 |
> |
31 |
>I doesn't seem like disabling swap is such a good idea, especially on |
32 |
>a commercial server and especially when I'm going to be running a |
33 |
>second instance of the OS inside VMware. What if my site gets a bunch |
34 |
>of traffic for whatever reason all of a sudden? Maybe I'm compiling |
35 |
>my kernel at the same time, and running all kinds of tests in the |
36 |
>VMware'd OS. It seems like the swap needs to be there for times when |
37 |
>the system is really strained and the memory fills up with active |
38 |
>stuff. I remember when I was just starting with Gentoo I forgot to |
39 |
>enable the swap and kept getting an out of memory error during the |
40 |
>bootstrap. |
41 |
> |
42 |
>Maybe a better way to phrase my question is: Is it possible to set my |
43 |
>server up so it will use swap when it needs it and then free it back |
44 |
>up when it doesn't need it anymore? What makes me think that is |
45 |
>necessary is the fact that I see a very snappy response when browsing |
46 |
>my site after a fresh reboot. After it's been up for awhile, the swap |
47 |
>starts to fill and it slows down. Rebooting clears out the swap and |
48 |
>the snaps return. |
49 |
> |
50 |
>All I'm trying to do here is keep my site nice and fast. |
51 |
> |
52 |
> |
53 |
|
54 |
Hey Grant, this may not help, but I'm reading posts about disk cache |
55 |
going into physical memory, and I thought of something. Since you get |
56 |
better performance when you reboot, try this command as root: |
57 |
|
58 |
#sync |
59 |
|
60 |
See if that helps. That basically flushes the cache and sends it to |
61 |
disk where it would eventually go anyway. If so, then you know what's |
62 |
hogging all your memory. |
63 |
|
64 |
James |
65 |
|
66 |
-- |
67 |
My blog: http://www.crazydrclaw.com/ |
68 |
My homepage: http://james.colannino.org/ |
69 |
|
70 |
"Black holes are where God divided by zero." --Steven Wright |
71 |
|
72 |
|
73 |
-- |
74 |
gentoo-user@g.o mailing list |