Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian ISP (http://www.linux-archive.org/debian-isp/)
-   -   Preventing an apache mpm prefork from disk trashing (http://www.linux-archive.org/debian-isp/525350-preventing-apache-mpm-prefork-disk-trashing.html)

Emmanuel Kasper 05-12-2011 09:45 AM

Preventing an apache mpm prefork from disk trashing
 
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 ?

I know there nginx + fastcgi but I am not there yet :)

Emmanuel

Thomas Goirand 05-12-2011 10:58 AM

Preventing an apache mpm prefork from disk trashing
 
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


--
To UNSUBSCRIBE, email to debian-isp-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4DCBBD59.4080204@goirand.fr">http://lists.debian.org/4DCBBD59.4080204@goirand.fr

Atıf CEYLAN 05-12-2011 11:38 AM

Preventing an apache mpm prefork from disk trashing
 
On 05/12/2011 12: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 ?

I know there nginx + fastcgi but I am not there yet :)

Emmanuel




I suggest apache with fcgid (mpm-worker mode) and memcache module (not
memcached). Also php with APC cache extension.

Your server performance will increase min. %20.



--

/**

* @author Atıf CEYLAN

* Software Developer & System Admin

* http://www.atifceylan.com

*/

Emmanuel Kasper 05-16-2011 07:38 AM

Preventing an apache mpm prefork from disk trashing
 
Am 2011-05-12 12:58, schrieb Thomas Goirand:
> 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).

yes a kinf of fail2ban was on my todo list for a long time, might be the
right time to check
thanks for the tip

Manu


All times are GMT. The time now is 05:40 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.