PHP on Windows platform runs the Iis,apache,nginx performance and speed test log ____php

Source: Internet
Author: User
Tags set time

Test Purpose: Hide

Test goal: Only use data to speak, do not comment

Test platform: Garbage server, can better see the load

IIS6.0 Win2003 E5300 4G

The service side is unified to output a time.

<?=time ();? > or <%response.write (now ())%>


A. Iis+isapi

iis+php5.1.2 FastCGI worker process max=30 Queue 2000

Result: 5,400 times a minute


B. iis+fastcgi

Results: 4,000 times a minute with cotton. and 500 errors. I don't know why.

Fixed: I was improperly configured, causing obstruction ...

Now test it for 10,000 times ... It's exactly the same efficiency as the ASPX single page, with a slightly 1% extra overhead.


C.iis+aspx

One minute execution: 9,600 times


D.UPUPW (Nginx + php-cgi) pressure test pass only about 4800 with 500 errors

FIX: There is a performance problem with the default fastcgi setting, and a brute force request can cause 500 errors


E.uniserver Zero XI (apache+php) stable ... 9,800 times. Not surprisingly.


I don't know what happened. As long as PHP ran in CGI mode, the pressure went up there are 500 errors, adjusted Fastcgi_ext.ini also useless. Blame...


But now see a problem, is as long as windows, the limit of the sky also 10,000 times per minute. (E5300 garbage CPU)




[Types]
php=php
htm:1916250451=php//Let the IIS inside of a website (site digital ID see IIS) control let HTML also as PHP sent to the CGI to resolve
html:1916250451=php


[PHP]
Exepath=c:\php\php-cgi.exe
maxinstances=300
instancemaxrequests=20000
queuelength=2000
IDLETIMEOUT=300///When there is no connection request, how long time to close the process (in seconds)
Environmentvars=php_fcgi_max_requests:20000,phprc:c:\php\
; activitytimeout=600
; requesttimeout=600

; Red font part number to unify

About Queuelegth, this refers to the length of the master process queue, according to the site traffic should be reasonable adjustment. It is also the main adjustment parameters. Lowered, such as 10, you have been pressing the F5 refresh, will soon prompt you 500 error is no longer receive new connections, because the queue is full, The previous 10 have not finished processing, directly throw the client 500 prompt, discarded. Queues are processed to receive new link requests. So if you look at this time the server CPU, no more than 87% of the time, can be adjusted high ha, Of course, this is affected by the whole backstage system. In a completed background service system, the weakest link can be tested, slowly increase queuelength, starting from 100, Interval 2001 plus, slowly increase, when the F5 has been pressed, the CPU no longer elevated, and then a release,  Soon the page is displayed, indicating that the queue has been processed. Release F5 to the page display, the middle of this time difference, if you feel that the ideal state, then the queuelength is the best value. Queuelength too low, will cause the CPU is not full load but frequent 500 errors, refused to receive new connections; If the value is too high, it will be blocked for a long time, the page is displayed ... The maximum time is the PHP.ini setting timeout (default 30 seconds) ... So how to balance the user experience time, is a skill, and technology is irrelevant. Let's try it for ourselves.


In addition, the maximum request 20,000 times refers to a single process to the 2W time to restart the process. It consumes overhead. but not big.

But because CGI's unique asynchronous response mechanism allows the master process to send a child request to the slave process, this asynchronous model can handle many requests in parallel .... Suitable for high load website ... If you consider being hacker DDoS, then can also use fastcgi temporary top ... So if I was attacked, I wouldn't do that, because the thousands of/second limit load on IIS would have been of little value to DDoS. The correct approach is to encounter DDoS on the (hard +fastcgi) or IP (need auxiliary program to identify and automatically seal, manually sealed so many IP, not realistic)


Ordinary small Web sites, pv5w are recommended to use ISAPI method, reliable, stable, no performance problems.

High-load Web site, absolutely to use the FASTCGI model. In order to use the asynchronous process communication model, fully utilize the multi-core CPU to process more requests asynchronously. This is done with a lot of nuclear CPUs.


Finally my disposition, the feeling balance is also good ~ ~ ~

[Types]
php=php
htm:1916250451=php
html:1916250451=php


[PHP]
Exepath=c:\php\php-cgi.exe
Maxinstances=8
instancemaxrequests=20000
queuelength=2000
idletimeout=300
Environmentvars=php_fcgi_max_requests:20000,phprc:c:\php\
activitytimeout=300
requesttimeout=300


Of course, the production server is E5 2630V2 dual 24 core, so I tuned 8 process 2W request such a level flying! Limit the number of requests have not been measured, anyway, now completely no problem, can resist DDoS ... Rattle...


Instancemaxrequests is used to set application pool recycling. FastCGI the number of process requests reaches instancemaxrequests value 20000, the application pool is automatically recycled. The default value is 1000. The application pool is automatically recycled when the environment variable php_fcgi_max_requests reaches 20000. Requesttimeout sets the request timeout, which is the maximum time allowed for the request, and if the FASTCGI process request exceeds this setting, the value is 90 seconds. ACTIVITYTIMEOUT Specifies the maximum active time requested by the fastcgi process, and during the set time, the FASTCGI process and IIS do not communicate, terminating the process. The default value is 70 seconds.


Using Windows is primarily convenient and security can also be done well

With Linux is tough, but not too convenient ah, weighed down. When someone else is off work, you may still be doing VI. Forget it, install Windows ... Ha ha


-----------------------------the next day's split line-----------------------------

Today want to curse, because just now found yesterday the test data are inaccurate.

Ignore the network card traffic is full.

Because I use the wifi,2.4g150m limit speed is 4mb/s about ... It's not enough to test traffic.!!!!

Re-test today:


KANGLE+FASTCGI measured 1800 times/10 seconds is based on the IOCP model ... No words.

IIS+FASTCGI request 3,700 times/10 seconds

Iis+aspx 3,800 times/10 seconds

Uniserver Zero XI (apache+php) stable ... 3,800 times/10 seconds

Iis+php (ISAPI) 2000 times/10 seconds

iis+ a TXT file 3,800 times/10 seconds (description is E8200 the limit of this CPU+ICH7 chipset)


At this point, the dust settles ... nginx not measured, in fact, are fastcgi model architecture, the standard asynchronous socket model, the performance should be similar to Uniserver Zero XI,, (a little bit higher, calculate 4000, haha)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.