1 |
... |
2 |
> I would strongly advise you to make your own measurements and heed |
3 |
> your own counsel. I can only speak from my own experience, and I may |
4 |
> well be speaking a whole load of codswallop. Or I may be right and the |
5 |
> opposing view is wrong. Who's to tell? |
6 |
> |
7 |
> My own experience with backing swap has been almost uniformly bad, |
8 |
> especially on machines running Apache and MySQL due to the massive |
9 |
> performance hit it invariably causes. I see memory as a finite |
10 |
> resource - you only have so much of it, so use it wisely and stay away |
11 |
> from using all of it up. |
12 |
> |
13 |
> The oom killer is also a point of contention. The algorithm is |
14 |
> designed to try and detect the best pid to kill in order to keep the |
15 |
> machine up, but there is no measurement for "least important process". |
16 |
> So instead it has to infer it from time last used, time running and |
17 |
> various other bits. These assumptions can never be 100% right. |
18 |
> |
19 |
> I believe the best solution to running out of memory is well-written |
20 |
> apps that degrade or die gracefully when they hit out of memory |
21 |
> conditions. I always thought Apache was rather good at this, it would |
22 |
> simply kill of the child process and deliver an error. You seem to |
23 |
> have found a way round this :-) |
24 |
|
25 |
I'd like to know more about that if anyone has info on it. apache2 is |
26 |
supposed to detect when the system runs out of memory and proceed to |
27 |
kill child processes? It failed to do so on my system which then |
28 |
proceeded to lock up. |
29 |
|
30 |
> kashani's advice seems reasonable, tune your machine to suit it's |
31 |
> load. We've established that the problem was a client hitting your |
32 |
> webserver 300 times in a minute. That is a DOS, so the solution would |
33 |
> be to find a way to configure Apache to detect abuse like this and not |
34 |
> deliver the page. |
35 |
|
36 |
So any apache system that hasn't been configured with a special |
37 |
security module can be locked up by refreshing a page a suitable |
38 |
number of times within a suitable amount of time? |
39 |
|
40 |
> But back to swap. I have two cases where it is rather useful. This |
41 |
> notebook uses swap for image storage when hibernating, and my Sybase |
42 |
> database servers at work use swap well, retrieving data pages from |
43 |
> swap is faster than searching through the database indexes for where |
44 |
> they are, simply because the kernel alredy knows exactly where the |
45 |
> swapped data is on disk. But this is a niche circumstance and in no |
46 |
> way representative of a typical Linux machine's behaviour. |
47 |
|
48 |
In situations like the above, would you prefer a swap file to a swap |
49 |
partition? It sounds better to me. |
50 |
|
51 |
> Summary: Do your own tests, make your own conclusions and vigorously |
52 |
> defend them. |
53 |
> |
54 |
> Sorry for the complete lack of a definitive answer, we are victims of |
55 |
> TheRealWorldOutThere(tm) |
56 |
|
57 |
I can handle that. :) |
58 |
|
59 |
- Grant |