Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache 2.4.2: pages load slow |
|
Author |
|
Baardmans
Joined: 02 Feb 2012 Posts: 7 Location: Holland
|
Posted: Mon 25 Jun '12 11:03 Post subject: Apache 2.4.2: pages load slow |
|
|
Problem: Apache seems slow, loading a mediawiki seems to take about 7 seconds (after 4 it shows some output). Subsequent requests on the same vhost takes about 3 seconds. Opening another vhost with another mediawiki takes about 12 seconds (after 10 is shows some output). These are the login pages of the mediawiki.
Server info:
Memory: 12GB (in use: 2788 MB, Standby: 2118MB, Free 7362).
Windows Server 2008R2
Intel Xeon CPU E5620 @ 2.40GHz (2 processor) 16 cores total
SSD disks raid 5. (Software installed on C partition, Apache data on D partition, Mysql data on E partition, PHP cache on F partition (sessions, wiki cache).
TCP connections during test: 20.
Software:
Apache 2.4.2 win32 (right now 1 instance, i will need two in the long run or 4 depending on whether adding a static proxy speeds up pages or not)
FCGID 2.3.7
PHP 5.3 (no accelerator, tried with wincache with same results).
Mysql 5.5 (2 instances + 1 mysql 4.1 instance not used by Apache)
Config:
Code: |
onfiguration:
In file: C:/Software/Apache/conf/httpd-shared.conf
32: ServerAdmin ***
35: DirectoryIndex index.php
38: <Directory />
39: AllowOverride none
40: Require all denied
: </Directory>
42: <Files ".ht*">
43: Require all denied
: </Files>
47: LogFormat "%t %V %h %a \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %u %l" combined
48: LogFormat "%V %h %l %u %t \"%r\" %>s %b" common
49: RotateLogs On
50: RotateLogsLocalTime On
51: RotateInterval 86400
54: TypesConfig conf/mime.types
55: AddType application/x-compress .Z
56: AddType application/x-gzip .gz .tgz
59: ThreadsPerChild 150
60: MaxConnectionsPerChild 0
61: MaxMemFree 2048
66: <Location /server-status>
67: SetHandler server-status
68: Require local
: </Location>
72: <Location /server-info>
73: SetHandler server-info
74: Require local
: </Location>
79: Timeout 30
82: UseCanonicalName Off
85: ServerTokens Prod
86: ServerSignature Off
89: EnableSendfile off
90: EnableMMAP off
93: HostnameLookups Off
In file: C:/Software/Apache/conf/httpd-web.conf
10: ServerName ****
13: DocumentRoot "D:/Web/domains"
16: <Directory "D:/Web/domains">
17: Options FollowSymLinks ExecCGI
18: AllowOverride All
19: Require all granted
: </Directory>
23: VirtualDocumentRoot "D:/Web/domains/%-2.0+.%-1/%-3+/"
In file: C:/Software/Apache/conf/httpd-dynamic.conf
12: FcgidWrapper "c:/software/php/php-cgi.exe" .php
15: AddType application/x-httpd-php .php
16: AddHandler fcgid-script .fcgi .php
20: FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 500
23: FcgidMaxRequestsPerProcess 500
26: FcgidMaxProcesses 15
29: FcgidIOTimeout 120
30: FcgidIdleTimeout 120
33: FcgidMaxRequestLen 5242880
In file: C:/Software/Apache/conf/httpd-static.conf
11: KeepAlive On
12: MaxKeepAliveRequests 100
13: KeepAliveTimeout 5
16: AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript
17: BrowserMatch ^Mozilla/4 gzip-only-text/html
18: BrowserMatch ^Mozilla/4.0[678] no-gzip
19: BrowserMatch bMSIE !no-gzip !gzip-only-text/html
22: AcceptFilter http none
In file: C:/Software/Apache/conf/httpd-web-dynamic.conf
23: DefaultInitEnv APP_POOL_ID "web"
26: FcgidInitialEnv PHPRC "c:/software/php/conf/web"
30: Listen ***
33: PidFile "logs/web-dynamic/httpd-web-dynamic.pid"
34: CustomLog "logs/web-dynamic/access-web-dynamic-%Y-%m-%d.log" combined
35: ErrorLog "logs/web-dynamic/error-web-dynamic.log"
36: LogLevel warn
|
The config is split into multiple files so I can play/test with another Apache service that runs in the front end handling static requests (that does not load the dynamic file) and sending dynamic requests to this Apache service (that won't load the static file). However I don't think that splitting it multiple files should be the cause of the slow loading.
I have searched high and low on this forum for a fix and the http filter none does not improve performance.
Log File
Code: |
[Fri Jun 22 17:20:05.799708 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 5616 graceful kill fail, sending SIGKILL
[Sun Jun 24 22:47:54.057263 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 2352 graceful kill fail, sending SIGKILL
[Sun Jun 24 22:47:54.057263 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 1956 graceful kill fail, sending SIGKILL
[Sun Jun 24 22:47:54.058263 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 4728 graceful kill fail, sending SIGKILL
[Mon Jun 25 00:32:24.418907 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 6632 graceful kill fail, sending SIGKILL
[Mon Jun 25 00:32:24.418907 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 6684 graceful kill fail, sending SIGKILL
[Mon Jun 25 01:03:12.525612 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 4624 graceful kill fail, sending SIGKILL
[Mon Jun 25 01:03:12.525612 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 2568 graceful kill fail, sending SIGKILL
[Mon Jun 25 01:03:12.525612 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 2020 graceful kill fail, sending SIGKILL
[Mon Jun 25 01:03:12.525612 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 4672 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:02:47.217431 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 5480 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:04:53.224638 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 5720 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:06:53.231502 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 7008 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:06:53.231502 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 7864 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:06:53.231502 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 4184 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:06:53.231502 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 2384 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:14:31.312703 2012] [fcgid:warn] [pid 7296:tid 1360] (OS 10054)An existing connection was forcibly closed by the remote host. : [client 92.68.18.163:57125] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: ***
[Mon Jun 25 09:17:11.288853 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 3668 graceful kill fail, sending SIGKILL
[Mon Jun 25 09:19:11.295717 2012] [fcgid:warn] [pid 7296:tid 236] mod_fcgid: process 6092 graceful kill fail, sending SIGKILL
|
The log file is full of these warnings. However these seem to be for the killing of the fcgid and not problems with serving the pages.
I was thinking it could be the mysql/php combination however I have a hard time thinking of good tests to ensure that is the problem. So before I start getting into that specific area can anyone spot any potential problems in the configuration of Apache? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 25 Jun '12 16:11 Post subject: |
|
|
Those warnings are ok, don't worry about it.
How are your fcgid settings in your httpd.conf? |
|
Back to top |
|
Baardmans
Joined: 02 Feb 2012 Posts: 7 Location: Holland
|
Posted: Mon 25 Jun '12 23:29 Post subject: |
|
|
Hi James Blond,
Thanks for your reply! Good to know the warnings are ok.
These are my fcgid settings:
12: FcgidWrapper "c:/software/php/php-cgi.exe" .php
15: AddType application/x-httpd-php .php
16: AddHandler fcgid-script .fcgi .php
20: FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 500
23: FcgidMaxRequestsPerProcess 500
26: FcgidMaxProcesses 15
29: FcgidIOTimeout 120
30: FcgidIdleTimeout 120
33: FcgidMaxRequestLen 5242880
23: DefaultInitEnv APP_POOL_ID "web"
26: FcgidInitialEnv PHPRC "c:/software/php/conf/web" |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 26 Jun '12 10:33 Post subject: |
|
|
Baardmans wrote: |
TCP connections during test: 20.
|
Baardmans wrote: |
FcgidMaxProcesses 15
|
As you can see you allow less parallel PHP Processes than conntection established to your server. So 5 requests have to wait.
with PHP over fcgid you don't need AddType application/x-httpd-php .php in your config.
Another thing is that your PHP Processes die a500 requests. How many requests do you have? |
|
Back to top |
|
Baardmans
Joined: 02 Feb 2012 Posts: 7 Location: Holland
|
Posted: Tue 26 Jun '12 11:02 Post subject: |
|
|
-MaxProcess: That's so logical I am ashamed of myself haha
I'm going to set that value higher (starting with 100).
-Removing the addtype
-I understood that it is best to kill the processes at 500 as that limit is hard coded into PHP itself. However I can't seem to find the thread that I got this from.
I have about 4500 requests per day if the log is anything to go by.
Thanks again for the help.
Edit: I already see improvements in performance.
This is the configuration right now according to a post I now found:
Quote: | # Path to php-cgi
FcgidWrapper "c:/software/php/php-cgi.exe" .php
# Define the MIME-Type for ".php" files
#AddType application/x-httpd-php .php
AddHandler fcgid-script .fcgi .php
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 10000
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess 10000
# Maximum number of PHP processes
FcgidMaxProcesses 1000
FcgidMaxProcessesPerClass 250
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout 120
FcgidIdleTimeout 300
# Max request length
#FcgidMaxRequestLen 5242880
FcgidMaxRequestLen 1048576000 |
Seems like excessive values but I see no real performance hit. |
|
Back to top |
|
|
|
|
|
|