Apache is a very used HTTP WebServer.
And I can't count the number of times I have been working with clients using it in their architectures.
But often, it is used with the default configuration or slightly tuned.
Even if this is normally not part of my job, I guess it's important to know how to use it properly.
You may also take a look at the post I wrote about SSL between Apache & WLS.
First of all : monitoring your workers
Well, first of all, I think it's essential to know how your Apache WS reacts.
Indeed, when load-testing your application, it's good to know how your application server behaves,
(hoping it's WebLogic ;) ) but it's also good to know if the webserver (or a load balancer hardware) is not a potential bottleneck.
To do so, it's quite easy : just activate the webserver status like shown below :
LoadModule status_module modules/mod_status.so
Deny from all
Allow from .foo.com
# Conf WLS ...
Let me explain that configuration.
- => LoadModule [...]/mod_status.so : mandatory if we want to monitor Apache (more info)
- => ExtendedStatus : allows to see some additional configuration, like CPU, memory ... Essential then. Beware of the performance !
- => Location /server-status : all incoming requests on this URI will be handled by the server-status
- => LocationMatch "/(?!server-status)" : requests on all the other URIs will be handled by WebLogic
Note : LocationMatch allows you to use regular expressions. I personnaly refer to python doc when needed.
Result : what does it display ?
What's important here is: 1 requests currently being processed, 249 idle workers
And if you look at your default configuration, you'll see that the number of requests "currently being processed" added
to the number of idle workers is the number set in the httpd.conf : ThreadsPerChild 250
Considering the scoreboard :
_" Waiting for Connection
S" Starting up
R" Reading Request
W" Sending Reply
K" Keepalive (read)
D" DNS Lookup
C" Closing connection
G" Gracefully finishing
I" Idle cleanup of worker
." Open slot with no current process
We then have one working thread 'W', 249 idle '_' and a big number that do nothing.
Sizing your Apache
Let's take a number of ThreadsPerChild equal to 1920.
If we set that value, what's displayed is different :
I've reached the maximum number of workers for my configuration.
That way, Apache will reserve all the possible workers to serve requests.
This configuration implies a higher CPU activity. That's why you've got to adjust the number of workers, following your
capacity planning, in order to have a good compromise.
Note : It's not the only parameter you can play with to tune your webserver, but this one is quite important.