LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 05-28-2012, 06:12 AM   #1
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL 6.x, 5.x, Fedora 20, Kubuntu 12.04, Solaris 10,8
Posts: 321

Rep: Reputation: 17
Viewing Apache 2.x compile options (HARD_SERVER_LIMIT)


Hi, how do I view the HARD_SERVER_LIMIT compile time option in httpd 2.x ?

I have tried executing "httpd -V" and also a strings on the binary.

I am curious to discover how my httpd was compiled with which particular options, I understand the default is 256, but I'd like to be more certain.

Thanks
 
Old 05-29-2012, 01:14 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 248

Rep: Reputation: 107Reputation: 107
Hi there,

I'm not sure whether "httpd -V" is 100% reliable for this, as someone might have edited src/include/httpd.h instead to change HARD_SERVER_LIMIT, in which case I don't think it will show up in "httpd -V".

One way to confirm this is to change MaxClients to above what you think HARD_SERVER_LIMIT is (i.e. to 257+ if we assume the default HARD_SERVER_LIMIT of 256 is in force), and run "apachectl configtest" or "httpd -t" to test the syntax of the config file. If MaClients is higher than HARD_SERVER_LIMIT you'll get an error message similar to this:

Quote:
WARNING: MaxClients of 257 exceeds compile time limit of 256 servers,
lowering MaxClients to 256. To increase, please see the
HARD_SERVER_LIMIT define in src/include/httpd.h.
Regards,

Clifford
 
Old 05-29-2012, 03:06 AM   #3
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL 6.x, 5.x, Fedora 20, Kubuntu 12.04, Solaris 10,8
Posts: 321

Original Poster
Rep: Reputation: 17
I am using Apache 2.2.15.

In which container, prefork.c or worker.c should the MaxClients be modified ?

When I change it within prefork.c, I receive the following message.

Code:
:~> sudo apachectl configtest
WARNING: MaxClients of 257 exceeds ServerLimit value of 10 servers,
 lowering MaxClients to 10.  To increase, please see the ServerLimit
 directive.
Syntax OK
And when I change MaxClients in worker.c, to 5000 I receive no error.
Code:
:~> sudo apachectl configtest
Syntax OK
Changing the MaxClients value within both containers does not retun any message about the compile time option HARD_SERVER_LIMIT.

Last edited by dazdaz; 05-29-2012 at 03:39 AM.
 
Old 05-29-2012, 05:37 AM   #4
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 248

Rep: Reputation: 107Reputation: 107
Whether you are using prefork or worker MPM depends on your configuration (see https://httpd.apache.org/docs/2.0/mpm.html). One way to tell which is in use, is to run "httpd -V" and look for the "Server MPM" line. Alternately run "httpd -l", and look for prefork.c or worker.c in the output.

If you're changing things in the source, I trust you are recompiling too, otherwise your changes will have no effect. If so, the MPM is specified with the "--with-mpm=MPM" option to the configure command. The default is prefork on Unix.

If you are recompiling, is there a reason for running Apache 2.2.15 and not the latest patch level (2.2.22)?

The correct way to change #define values is to add something like "-D HARD_SERVER_LIMIT=1024" to your CFLAGS environment variable before compiling.

How did you conclude that HARD_SERVER_LIMIT is the problem? As far as I can tell, this setting isn't used in the Apache 2.2 worker or prefork MPMs; they use MAX_SERVER_LIMIT, which is set as follows (as per https://httpd.apache.org/docs/2.2/mo...#serverlimit):
Quote:
There is a hard limit of ServerLimit 20000 compiled into the server (for the prefork MPM 200000). This is intended to avoid nasty effects caused by typos.
Have you checked for a ServerLimit directive in your config files that may be causing the problem? Changing this should solve the problem.
 
Old 05-31-2012, 05:28 AM   #5
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL 6.x, 5.x, Fedora 20, Kubuntu 12.04, Solaris 10,8
Posts: 321

Original Poster
Rep: Reputation: 17
Hi, I found what your referring to in the source code.

It would appear that the C definition of HARD_SERVER_LIMIT in 1.x is now called MAX_SERVER_LIMIT in Apache 2.x and the limit is now much higher in 2.x than in 1.x

Ok I finally understood your reply, thank you ! Yes, I will recompile and upgrade. 2.4.2 is the latest current release, not 2.2.15.

Code:
$ httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
Code:
server/mpm/prefork/prefork.c:#define MAX_SERVER_LIMIT 200000

Last edited by dazdaz; 05-31-2012 at 05:43 AM.
 
Old 05-31-2012, 10:55 AM   #6
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 248

Rep: Reputation: 107Reputation: 107
Hi again,

Based on the output you posted earlier, namely:

Code:
:~> sudo apachectl configtest
WARNING: MaxClients of 257 exceeds ServerLimit value of 10 servers,
 lowering MaxClients to 10.  To increase, please see the ServerLimit
 directive.
Syntax OK
It doesn't look like you need to change anything in your source code, as you are nowhere near those limits.

The problem is more likely to just be a configuration problem, with ServerLimit set too low somewhere.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile options teufelhund Slackware 5 04-12-2006 02:22 AM
kernel compile options keysoft Linux - Newbie 4 02-24-2005 12:01 AM
Viewing the default kernel options six6 Mandriva 9 07-22-2004 03:21 PM
Viewing apache via router sy-co Mandriva 6 06-20-2004 04:12 PM
emerge compile options MrJoshua Linux - Software 0 06-07-2004 03:58 PM


All times are GMT -5. The time now is 08:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration