Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Thursday, June 19, 2008

Apache MaxClients

This isn't an exact science, but assuming you're using pre-fork and not MPM inside Apache 2, you should be able to estimate your MaxClients setting using the following strategy.

1) calculate average RSS usage for apache

Do a ps -ylC httpd and average the RSS column using a spreadsheet or command-line trickery. This gives you the average memory size of your Apache children.

2) apply the following formula

(server RAM * MEM percent dedicated) / average RSS usage

Given a server with 10 Gigs of RAM with 80% dedicated to Apache and an average RSS size of 20 megs, and using Google as a calculator:

(10 gigabytes * .80) / (20 megabytes) = 409.6 connections

From there, you could set MaxClients to roughly 400 connections and monitor resource usage. As always, peak load performance must be taken into account as well. Like I said, it's not an exact science; rather, a simple strategy for establishing a baseline value.