test
[hcoop/zz_old/ikiwiki] / DaemonAdmin / Apache.mdwn
1
2 This page describes how to deal with Apache issues. It is intended for use by HCoop administrators.
3
4 [[TableOfContents]]
5
6 == Dealing with too many apache processes ==
7
8 Sometimes on our old machines (fyodor), too many apache processes are run, and they consume all available memory. In case this same problem is ever experienced on the new machines, it could be handy to know how to do this recovery procedure.
9
10 This problem can be diagnosed by running
11
12 {{{
13 free
14 }}}
15
16 to check the amount of memory being used, and
17
18 {{{
19 ps -e | grep [a]pache2 | wc -l
20 }}}
21
22 to see how many Apache processes are running. If there are around 100 processes or more running, and we have less than 60MB memory free, and are using more than 50% of swap, we need to continue with the "apache2 draining" procedure listed below.
23
24 To get rid of apache2 processes, do the following.
25
26 {{{
27 iptables -I INPUT 1 --proto tcp --dport 80 -j REJECT
28 /etc/init.d/apache2 stop # wait about 5 minutes, then hit Ctrl+c a few times to stop
29 killall apache2
30 killall -9 apache2
31 /etc/init.d/apache2 start
32 iptables -D INPUT 1
33 }}}
34
35 Now check to see whether member websites can be browsed. Also, check to see whether the amount of free memory has increased substantially.