Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm building monitoring system that will detect how many (idle) requests are currently being processed. The method that I'm using to detect this is by connecting to http://localhost/server-status .

The question is, if Apache can't serve any more new connection (ex: MaxClients reached the top) how am I able to detect apache statistic then? Is it possible that Apache is smart enough to ignore MaxClients configuration for connections from localhost?

Any help is appreciated.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

I believe the answer is no, with two reasons (and a third, wooly one):

  1. Suppose requests to /server-status/ were immune to MaxClients (but incremented the client count). Then, it would become too easy to DoS apache with requests so legitimate ones cannot be served (and since they can go way over MaxClients, there is no chance real ones will ever get responded to)

  2. Apache will likely have it's client count based on [some function of] the number of open connections (one connection to :80 can only send one request at a time, but KeepAlive allows us to reuse it, so open one TCP connection is essentially one client). This will be checked before the headers are even read (if there is space, it will delegate the request to be dealt with. If there aren't, it'll fail fast).

  3. Whenever I'm overloaded with connections, service httpd fullstatus works really slowly or not at all :-)

share|improve this answer
    
about 3) It's interesting that in debian I can't use /etc/init.d/apache2 status. I have to use #apache2ctl status which is just bash scripts that connects to localhost/server-status. –  confiq Nov 4 '12 at 14:59
1  
Yeah, the latter used to work (/etc/init.d/apache2 status) but I don't know why they changed it. IIRC all implementation of that just did lynx -dump http://localhost/server-status anyway. –  Jay Nov 4 '12 at 15:01
add comment

You might need to write an apache module (or modify mod_status) so that other interface is used for the communication with apache server. You might want to use posix signals and shared memory or a file to request and get the stats.

share|improve this answer
1  
Sorry, but there's simply no other way to do it. –  FINESEC Nov 4 '12 at 13:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.