Re: Preventing an apache mpm prefork from disk trashing
Thomas Goirand <[email protected]>
| Newsgroups | gmane.linux.debian.user.isp |
|---|---|
| Organization | GPLHost |
| Message-ID | <[email protected]> |
On 05/12/2011 05:45 PM, Emmanuel Kasper wrote: > Hello > > I have a wordpress blog running with apache in prefork mode ( all debian > packages ) I have noticed that by traffic peaks ( think reddit ), Apache > starts to swap heavily becauses it creates too much processes according > to the RAM of the machine. > > I have been thinking of reducing MaxClients so that MaxClient * ResRAM > apache process < RAM of the server. > > Is that the correct way to treat this problem ? Yes, that's the way. And I would also recommend to limit the maximum number of connection to port 80 with iptables, just in case someone is flooding. Do a -j DROP, so that clients will retry for a while to connect in case it goes busy. You can also use bwshare to limit the number of connections per IP (also a good protection against flooding). Anyway you do, at some point, you'll have to add more RAM, or do a cluster with HAproxy, IMHO. RAM is cheap... Thomas