logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Check Apache httpd prefork or worker limits...

 
Post new topic   Reply to topic    Apache Forum Index -> How-to's & Documentation & Tips



View previous topic :: View next topic  
Author Message
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Sun 11 Nov '12 20:56    Post subject: Check Apache httpd prefork or worker limits... Reply with quote

Hi everyone,

I wrote a script to analyze the size of httpd processes and report if the MaxClients/ServerLimit values are too high/low, etc. Thought I'd share. Wink

http://surniaulula.com/2012/11/09/check-apache-httpd-prefork-or-worker-limits/

And on Google Code https://code.google.com/p/check-httpd-limits/

js.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Mon 12 Nov '12 0:25    Post subject: Reply with quote

H,
I get some warnings
Quote:

Use of uninitialized value in numeric eq (==) at ./check_httpd_limits.pl line 212.
WARNING: MaxRequestsPerChild is 0. This is usually not recommended.
Use of uninitialized value in multiplication (*) at ./check_httpd_limits.pl line 248.
Use of uninitialized value in numeric eq (==) at ./check_httpd_limits.pl line 255.
Use of uninitialized value in multiplication (*) at ./check_httpd_limits.pl line 261.
Use of uninitialized value in concatenation (.) or string at ./check_httpd_limits.pl line 306.
OK: Maximum HTTP procs (ServerLimit : 3 MB) fits within the available RAM (ProjectFree 1961 MB).



In the script and the help usage there are some trouble about -e or -c as parameter Wink

Would be nice if that script would work with event mpm, too.
Back to top
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Mon 12 Nov '12 1:57    Post subject: Reply with quote

Thanks for letting me know - yeah small, mix-up there about the -c and -e. Wink I changed it to -e since the parameter is used internally to compare with /proc/*/exe files.

I added some additional debugging messages, so the -d parameter should be even more useful to track down the problem. Using -v might also provide more information on the various values the script is picking up too.

Hopefully we can get this ironed out quickly for you. Wink

BTW, I zippped up the current version and put it in the download area: http://code.google.com/p/check-httpd-limits/downloads/list

Thanks,

js.
Back to top
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Wed 14 Nov '12 0:52    Post subject: Reply with quote

FYI - Following your post, I had a chance to work on the script a bit more and made quite a few changes... The command-line options have changed, it uses SQLite (only if) you use the --save/days/maxavg options, and I've written some documentation on the Google Code wiki section. ;-)

http://code.google.com/p/check-httpd-limits/wiki/Documentation

Let me know what you think.

Thanks,

js.
Back to top
Millennium



Joined: 17 Apr 2006
Posts: 179
Location: Leiderdorp, NL, EU

PostPosted: Wed 14 Nov '12 10:27    Post subject: Re: Check Apache httpd prefork or worker limits... Reply with quote

jsmoriss wrote:
Hi everyone,

I wrote a script to analyze the size of httpd processes and report if the MaxClients/ServerLimit values are too high/low, etc. Thought I'd share. Wink

http://surniaulula.com/2012/11/09/check-apache-httpd-prefork-or-worker-limits/

And on Google Code https://code.google.com/p/check-httpd-limits/

js.


Seems intresting, but how to work it on Win32?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Wed 14 Nov '12 12:51    Post subject: Reply with quote

I've made a patch for event mpm --> http://pastebin.com/raw.php?i=Gk63tn42 There are also some changes on the default value. I took the real default values from apache 2.4 http://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x/docs/conf/extra/httpd-mpm.conf.in

Quote:

Seems intresting, but how to work it on Win32?


Simply it does work on windows yet. At least the verbose part of the script would be a lot of change on the script to port it to windows.
Back to top
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Thu 15 Nov '12 18:12    Post subject: Reply with quote

James,

Thanks for the contribution. I made additional changes to incorporate the differences between 2.2 and 2.4. The link you provided to the 2.4 defaults are those from the 2.4 config, not the 2.4 defaults compiled into the binary. I'm predefining values in case the option is missing from the config file, so the binary defaults are more appropriate.

I've been able to test the script on a variety of prefork servers up to v2.2, but I don't have any v2.4 or worker/event servers. Let me know how it works out for you.

Thanks,

js.
Back to top
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Thu 15 Nov '12 18:17    Post subject: Re: Check Apache httpd prefork or worker limits... Reply with quote

Millennium wrote:

Seems intresting, but how to work it on Win32?


The script uses files under /proc, like /proc/meminfo, /proc/*/stat, etc., which (as far as I know) are only available in Linux.

Aside from that, the rest of the script should be compatible - perhaps with a few minor tweeks here and there - but an alternative to /proc for Windows would have to be found.

Thanks,

js.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Thu 15 Nov '12 18:46    Post subject: Reply with quote

With Revision 33 it works almost fine.
It does not seem to read the config correctly.
http://pastebin.com/raw.php?i=PJNfUx35
Back to top
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Thu 15 Nov '12 19:00    Post subject: Reply with quote

James Blond wrote:
With Revision 33 it works almost fine.
It does not seem to read the config correctly.
http://pastebin.com/raw.php?i=PJNfUx35


Lol! Ok, thanks -- I just checked-in a minor revision in the trunk. Could you have a look and let me know if that fixes your problem?

Thanks!

js.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Thu 15 Nov '12 19:14    Post subject: Reply with quote

I'm a bit confused about the Possible Changes part. Since it does not show / reflect the values that I use. The rest works fine.

my config
Quote:

<IfModule mpm_event_module>
StartServers 3
MaxClients 320
MinSpareThreads 40
MaxSpareThreads 120
ThreadsPerChild 20
MaxConnectionsPerChild 0
</IfModule>


Quote:

Possible Changes

<IfModule mpm_event_module>
MaxConnectionsPerChild 0 # (no change) Default is 0
MaxRequestWorkers 5623 # (400 -> 5623) ServerLimit * ThreadsPerChild
MaxSpareThreads 250 # (no change) Default is 250
MinSpareThreads 75 # (no change) Default is 75
ServerLimit 225 # (16 -> 225) (MemFree + Cached + HttpdRealTot + HttpdSharedAvg) / HttpdRealAvg
StartServers 3 # (no change) Default is 3
ThreadsPerChild 25 # (no change) Default is 25
</IfModule>

Back to top
jsmoriss



Joined: 11 Nov 2012
Posts: 8
Location: Montreal QC, Canada

PostPosted: Thu 15 Nov '12 19:36    Post subject: Reply with quote

James Blond wrote:
I'm a bit confused about the Possible Changes part. Since it does not show / reflect the values that I use. The rest works fine.


Ah, yes, how about this then? :)

Code:

Config for 100% of MemTotal

   <IfModule prefork.c>
        MaxClients                29    # (40 -> 29) (MemFree + Cached + HttpdRealTot + HttpdSharedAvg) / HttpdRealAvg
        MaxRequestsPerChild     3000    # (no change) Default is 10000
        MaxSpareServers           10    # (no change) Default is 10
        MinSpareServers            5    # (no change) Default is 5
        ServerLimit               29    # (40 -> 29) MaxClients
        StartServers               5    # (no change) Default is 5
   </IfModule>


And yeah, my web server needs more RAM. ;-)

Worker or Event would be nice, but I'm using PHP - which adds a whole new set of issues. :-p

Thanks,

js.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Fri 16 Nov '12 10:32    Post subject: Reply with quote

jsmoriss wrote:

Ah, yes, how about this then? Smile


That is very nice!

jsmoriss wrote:

Worker or Event would be nice, but I'm using PHP - which adds a whole new set of issues. :-p


That is why I use PHP over mod_fcgid (Windows and Linux). I made a small how to apache 2.4 with mod_fcgid on debian for it. I never want to use prefork again on my own servers.
Back to top


Post new topic   Reply to topic    Apache Forum Index -> How-to's & Documentation & Tips
Page 1 of 1