Author |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Tue 11 Feb '14 15:49 Post subject: |
|
|
James Blond wrote: | Do I get it right that if you define -processes 1 you have one single instance of php-cgi.exe running in your task manager?
What does happen if that instances crashes? Does fastcgi start a new one? Do requests fail it that case? |
Yes, if -process is set to 1 then there is only one php-cgi.exe instance running and if it crashes it is automatically re-spawn by mod_fastcgi. Also if just one is running then there are no errors.
If I kill the only running process manually during a load test then out of 10000 requests there just 1 or 2 failed requests while the process is re-spawned.
It takes less than a second to respawn the process on my server, and while the process is being restarted the incoming requests seem to be waiting in a queue.
This module is very promising. In terms of performance mod_FastCGI outperforms mod_FCGID many times. Under some load conditions my tests show 1000% (10 times) better performance (depending on load and concurrency). But again until we figure out how to eliminate the errors I wouldn't put it in production. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 12 Feb '14 11:23 Post subject: |
|
|
I have written my own little performance tester. Rather than just the phpinfo() it does some load.
http://pastebin.com/raw.php?i=bjjfgVVS
Yes that script does more load than any normal script, but for testing it is nice |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Wed 12 Feb '14 13:52 Post subject: |
|
|
I will give it a spin and post the result. |
|
Back to top |
|
Millennium
Joined: 17 Apr 2006 Posts: 179 Location: Leiderdorp, NL, EU
|
Posted: Wed 12 Feb '14 21:57 Post subject: |
|
|
Result (mod_fcgid 2.3.9 + Php 5.5.9 NTS)
10.8125
Peak Memory: 242.56 Mb Peak Memory (real): 243.25 Mb memory usage: 242.53 Mb |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Wed 12 Feb '14 22:48 Post subject: |
|
|
Millennium wrote: | Result (mod_fcgid 2.3.9 + Php 5.5.9 NTS) | Hehehe,
No, result Apache 2.4 + mod_php on Windows or IIS + fastcgi. And on Linux definitely mod_fastcgi. |
|
Back to top |
|
C0nw0nk
Joined: 07 Oct 2013 Posts: 241 Location: United Kingdom, London
|
Posted: Wed 12 Feb '14 23:13 Post subject: |
|
|
jimski wrote: | Millennium wrote: | Result (mod_fcgid 2.3.9 + Php 5.5.9 NTS) | Hehehe,
No, result Apache 2.4 + mod_php on Windows or IIS + fastcgi. And on Linux definitely mod_fastcgi. |
So whats better for windows apache out of mod_fastcgi and mod_fcgid ? I thought that was the original question |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Wed 12 Feb '14 23:27 Post subject: |
|
|
C0nw0nk wrote: |
So whats better for windows apache out of mod_fastcgi and mod_fcgid ? I thought that was the original question |
We are still working on it but if the errors on mod_fastcgi on windows can be fixed then I would definitely go with mod_fastcgi. If not then mod_php would be my choice because of simplicity and a very good performance executing php. Although there is one danger here. In my tests I got mod_php to serve 1000 concurrent connections on windows x64 but beyond that it would choke and either crash or stop responding for couple of minutes. On another hand mod_FCGID was much slower but would take more concurrent connections however they would wait in a queue for execution. Please note that I'm only talking about serving php. When it comes to static content nginx on Windows 32Bit, which you recommended, beats the pants down of Apache in any configuration. I haven't tested Nginx on windows x64 yet, also on x64 nginx doesn't support caching.
I'm not giving up easily. I will get in touch with guys who wrote the code and I will also do more experiments with different versions of php and windows as well as older versions of mod_fastcgi for apache 2.2 which is still a good webserver.
Last edited by jimski on Fri 14 Feb '14 22:54; edited 1 time in total |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Thu 13 Feb '14 4:16 Post subject: |
|
|
James, that's a nasty test. I have reduced the number of requests to 1000 because I don't want to get old while waiting for completion.
Here are the results: using JamesBlondTest.php
Test using mod_FastCGI Apache 2.4 php 5.3.8 nts
1 processes
Time taken for tests: 224.7 seconds
Completed requests: 1000 (concurrency 100)
Failed requests: 420
Requests per second: 4.44
Test using mod_FastCGI Apache 2.4 php 5.3.8 nts
10 processes
Time taken for tests: 223.5 seconds
Completed requests: 1000 (concurrency 100)
Failed requests: 389
Requests per second: 4.42
Test using mod_FCGID Apache 2.4 php 5.3.8 nts
10 processes
Time taken for tests: 251.2 seconds
Completed requests: 1000 (concurrency 100)
Failed requests: 343
Requests per second: 3.98
Test using mod_PHP Apache 2.4 php 5.3.8 ts
Time taken for tests: 340.1 seconds
Completed requests: 1000 (concurrency 100)
Failed requests: 542
Requests per second: 2.94 |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Thu 13 Feb '14 16:26 Post subject: |
|
|
I know that it is not a usual test, BUT it shows that both f(ast)fcgi(d) solutions performed better than the module!
It also seems that surprisingly fastcgi with 10 processes to work better than 1 process, if it comes to a lot of load and stability. Yepp the 1 process was it a bit faster, but I guess it because of the more failed requests.
I wonder why in this test different to the simple phpinfo() test fcgid was more stable than fastcgi. Ok it was a bit slower by requests per second. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Thu 13 Feb '14 20:10 Post subject: |
|
|
James Blond wrote: | I know that it is not a usual test, BUT it shows that both f(ast)fcgi(d) solutions performed better than the module!
|
Yes, but this is an extreme test case. Each module has its own performance curve and probably mod_php doesn't cope very well with requests of this type.
I will try mod_php again with different mpm_winnt settings to give it more threads. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Thu 13 Feb '14 23:14 Post subject: |
|
|
The only reason for me to switch from mod php to fcgid was that apache did not longer crash even with unstable php.
Now it is also the speparation of the processes and with more cores it run more performant, cause it can use more cores. |
|
Back to top |
|
C0nw0nk
Joined: 07 Oct 2013 Posts: 241 Location: United Kingdom, London
|
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Fri 14 Feb '14 22:52 Post subject: |
|
|
C0nw0nk wrote: | ...has anyone ever done a test with nginx and php ?
|
I'm interested in answer to this question as well.
Although I'm not an Nginx expert, I will post some comparison in a few days as I'm testing Nginx alongside Apache.
However if there is an Nginx + Windows guru here then please let us know. |
|
Back to top |
|
C0nw0nk
Joined: 07 Oct 2013 Posts: 241 Location: United Kingdom, London
|
Posted: Fri 14 Feb '14 22:59 Post subject: |
|
|
I run nginx on windows in production but i use it for delivering static content i can post my config here if it helps. The apache builds from here are the backend of it for my dynamic content. |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Fri 14 Feb '14 23:52 Post subject: |
|
|
C0nw0nk wrote: | I run nginx on windows in production but i use it for delivering static content i can post my config here if it helps. The apache builds from here are the backend of it for my dynamic content. |
That would be greatly appreciated!
I've tried setting up nginx as a caching proxy/front end for apache in the past on Windows but always failed at making it work properly.
Did you see any performance improvement by doing this compared to apache on windows?
I ask this because I see this on the nginx website, regarding Windows builds:
Quote: | Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. |
Did you get spdy to work with nginx on Windows? |
|
Back to top |
|
C0nw0nk
Joined: 07 Oct 2013 Posts: 241 Location: United Kingdom, London
|
Posted: Sat 15 Feb '14 1:57 Post subject: |
|
|
gijs wrote: | That would be greatly appreciated!
I've tried setting up nginx as a caching proxy/front end for apache in the past on Windows but always failed at making it work properly.
Did you see any performance improvement by doing this compared to apache on windows?
I ask this because I see this on the nginx website, regarding Windows builds:
Quote: | Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. |
Did you get spdy to work with nginx on Windows? |
Works fine for me running one of the top 70,000 sites on the web. Built in Joomla 2.5 running apache 2.4.6 mod_fcgi, Nginx 1.5.10, PHP 5.5.7 with wincache. (All 64bit), (NGinx is 32bit).
It delivers static content extremely fast i also recommend a few tools to help improve performance, I use them in production and they work fine for me windows server 2008.
TCP/IP Windows registry stack optimizer
File optimizer. (Compresses and optimizes image files flash rar zip archives making them smaller saving bandwidth.)
http://nikkhokkho.sourceforge.net/static.php?page=FileOptimizer
Also with spdy as far as im aware and what they say on the nginx page it is only for ssl. (I do use cloudflare they run linux servers and they use spdy)
nginx 1.5.10 config : (32bit)
Code: | #user nobody;
worker_processes 1;
error_log logs/error.log crit;
events {
worker_connections 1900000;
multi_accept on;
}
worker_rlimit_nofile 20000000;
http {
include mime.types;
default_type application/octet-stream;
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_requests 100000;
client_max_body_size 1000m;
server_tokens off;
etag off;
open_file_cache max=900000 inactive=10m;
open_file_cache_valid 20m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
server {
listen 80;
server_name domain.com www.domain.com;
root c:/server/websites/ps/public_www;
index index.php index.html index.htm default.html default.htm;
location / {
root c:/server/websites/ps/public_www;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8000;
expires 3s;
max_ranges 0;
}
location ~ \.flv$ {
flv;
limit_rate 200k;
root c:/server/websites/ps/public_www;
expires max;
valid_referers none blocked domain.com www.domain.com;
if ($invalid_referer) {
return 403;
}
}
location ~ \.mp4$ {
#mp4;
limit_rate 200k;
root c:/server/websites/ps/public_www;
expires max;
valid_referers none blocked domain.com www.domain.com;
if ($invalid_referer) {
return 403;
}
}
location ~ \.gif$ {
limit_rate 50k;
root c:/server/websites/ps/public_www;
expires max;
valid_referers none blocked domain.com www.domain.com;
if ($invalid_referer) {
return 403;
}
}
location ~* \.(avi|m4v|mov|divx|webm|ogg|mp3|mpeg|mpg|zip|rar)$ {
limit_rate 90k;
root c:/server/websites/ps/public_www;
expires max;
valid_referers none blocked domain.com www.domain.com;
if ($invalid_referer) {
return 403;
}
}
location ~* \.(ico|png|jpg|jpeg|gif|flv|mp4|avi|m4v|mov|divx|webm|ogg|mp3|mpeg|mpg|swf|css|js|txt|zip|rar|xml)$ {
root c:/server/websites/ps/public_www;
expires max;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
#deny all;
return 404;
}
location ~ ^/(xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info|cpanel|configuration.php) {
#deny all;
return 404;
}
}
} |
Make nginx listen for ipv6
The other thing is nginx can accept ipv6 connections apart from ipv4 so it basically converts my apache server to a ipv6 host too. (I had to remove all ip addresses for security reasons and links to the domain name of the site on that machine since it is a porn host.)
Please try not to derail this thread though i feel we are getting off topic.
I will be happy to share my apache config too if anyone feels it helps also i will also add everything i run is 64Bit except nginx what is 32bit. But it is all very stable no crashes or downtime not sure if it is worth me running a benchmarking tool with it or not. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Sat 15 Feb '14 5:05 Post subject: |
|
|
C0nw0nk wrote: |
Please try not to derail this thread though i feel we are getting off topic.
|
I have started a separate thread about Nginx
http://www.apachelounge.com/viewtopic.php?p=26890#26890
Lets move our comments about Nginx to the new thread and delete them from this thread. |
|
Back to top |
|
C0nw0nk
Joined: 07 Oct 2013 Posts: 241 Location: United Kingdom, London
|
Posted: Mon 17 Feb '14 18:13 Post subject: |
|
|
jimski wrote: | C0nw0nk wrote: |
Please try not to derail this thread though i feel we are getting off topic.
|
I have started a separate thread about Nginx
http://www.apachelounge.com/viewtopic.php?p=26890#26890
Lets move our comments about Nginx to the new thread and delete them from this thread. |
Thanks jim now back ontopic for apache being stable in a non threaded enviorment.
What do you recommend as the most stable php version to be running with mod_fcgid-2.3.9 vc11 x64.
I am currently using php 5.5.7 x64 nts. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Tue 18 Feb '14 23:02 Post subject: |
|
|
So far the most stable combination on my server running windows 2003 x64 was Apache 2.4.4 or 2.4.7 and PHP 5.3.28 x64 VC9.
PhP 5.4 was giving me random errors and other unexplained events.
I didn't test yet Apache VC11 and PHP 5.5.x
They are both on my list.
I came across of another interesting finding. Mod_FCGID performance on dual quad core Xeon 2.8Ghz with tons of ram was best when running between 8 to 12 php-cgi.exe processes. Adding additional processes marginally improved failed requests rate at high concurrency but at a cost of longer execution time and overall lower performance.
When running mod_PHP I would encourage everyone to experiment with win_mpm settings. The default settings severely restrict mod_php performance. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Wed 19 Feb '14 5:00 Post subject: |
|
|
James Blond wrote: | I know that it is not a usual test, BUT it shows that both f(ast)fcgi(d) solutions performed better than the module! | What it really showed is that the nts version of PHP 5.3 is faster than the ts version.
A fair comparison between the module and mod_fcgid would be to load the ts version in both. |
|
Back to top |
|