SolidState
Verified User
- Joined
- Jul 26, 2011
- Messages
- 11
help needed in optimization on apache 2....
Does anybody has some optimized /httpd-mpm.conf and /httpd-default.conf for apache2.
My server:
AMD Phenom(tm) II X4 840 Processor (4 core)
8 GB ram
centos 5.x 32bit
directadmin
my memory usage is insane in top output:
top - 09:18:23 up 11 days, 22:27, 1 user, load average: 0.34, 0.33, 0.36
Tasks: 190 total, 2 running, 188 sleeping, 0 stopped, 0 zombie
Cpu(s): 6.6%us, 0.8%sy, 0.0%ni, 92.5%id, 0.1%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 8049732k total, 7490088k used, 559644k free, 305148k buffers
Swap: 8193140k total, 0k used, 8193140k free, 6316636k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27868 apache 15 0 37928 23m 3420 S 9.0 0.3 0:00.36 httpd
27887 apache 15 0 28068 12m 3000 S 0.7 0.2 0:00.02 httpd
4667 named 17 0 71652 4824 2068 S 0.3 0.1 26:00.31 named
23910 mysql 15 0 295m 104m 2668 S 0.3 1.3 0:00.43 mysqld
27869 apache 15 0 0 0 0 Z 0.3 0.0 0:01.28 httpd <defunct>
27883 root 15 0 2444 1092 812 R 0.3 0.0 0:00.13 top
27893 apache 15 0 28192 13m 3408 S 0.3 0.2 0:00.01 httpd
1 root 15 0 2176 608 528 S 0.0 0.0 0:00.86 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.75 migration/0
3 root 37 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.55 migration/1
httpd-mpm.conf:
httpd-default.conf:
Does anybody has some optimized /httpd-mpm.conf and /httpd-default.conf for apache2.
My server:
AMD Phenom(tm) II X4 840 Processor (4 core)
8 GB ram
centos 5.x 32bit
directadmin
my memory usage is insane in top output:
top - 09:18:23 up 11 days, 22:27, 1 user, load average: 0.34, 0.33, 0.36
Tasks: 190 total, 2 running, 188 sleeping, 0 stopped, 0 zombie
Cpu(s): 6.6%us, 0.8%sy, 0.0%ni, 92.5%id, 0.1%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 8049732k total, 7490088k used, 559644k free, 305148k buffers
Swap: 8193140k total, 0k used, 8193140k free, 6316636k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27868 apache 15 0 37928 23m 3420 S 9.0 0.3 0:00.36 httpd
27887 apache 15 0 28068 12m 3000 S 0.7 0.2 0:00.02 httpd
4667 named 17 0 71652 4824 2068 S 0.3 0.1 26:00.31 named
23910 mysql 15 0 295m 104m 2668 S 0.3 1.3 0:00.43 mysqld
27869 apache 15 0 0 0 0 Z 0.3 0.0 0:01.28 httpd <defunct>
27883 root 15 0 2444 1092 812 R 0.3 0.0 0:00.13 top
27893 apache 15 0 28192 13m 3408 S 0.3 0.2 0:00.01 httpd
1 root 15 0 2176 608 528 S 0.0 0.0 0:00.86 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.75 migration/0
3 root 37 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.55 migration/1
httpd-mpm.conf:
Code:
#
# Server-Pool Management (MPM specific)
#
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
# Note that this is the default PidFile for most MPMs.
#
<IfModule !mpm_netware_module>
PidFile "/var/run/httpd.pid"
</IfModule>
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile /var/log/httpd/accept.lock
</IfModule>
</IfModule>
#
# Only one of the below sections will be relevant on your
# installed httpd. Use "apachectl -l" to find out the
# active mpm.
#
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 450
MaxClients 450
MaxRequestsPerChild 10000
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
ServerLimit 450
MaxClients 450
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 10000
</IfModule>
# BeOS MPM
# StartThreads: how many threads do we initially spawn?
# MaxClients: max number of threads we can have (1 thread == 1 client)
# MaxRequestsPerThread: maximum number of requests each thread will process
<IfModule mpm_beos_module>
StartThreads 10
MaxClients 50
MaxRequestsPerThread 10000
</IfModule>
# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxRequestsPerChild: Maximum number of requests a thread serves. It is
# recommended that the default value of 0 be set for this
# directive on NetWare. This will allow the thread to
# continue to service requests indefinitely.
<IfModule mpm_netware_module>
ThreadStackSize 65536
StartThreads 250
MinSpareThreads 25
MaxSpareThreads 250
MaxThreads 1000
MaxRequestsPerChild 10000
MaxMemFree 100
</IfModule>
# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process,
# to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxRequestsPerChild: Maximum number of connections per server process
<IfModule mpm_mpmt_os2_module>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 10
MaxRequestsPerChild 10000
</IfModule>
httpd-default.conf:
Code:
#
# This configuration file reflects default settings for Apache HTTP Server.
#
# You may change these, but chances are that you may not need to.
#
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 120
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 0
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 10
#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Major
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature On
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
TraceEnable Off