Based on what reason PHP than the other CGI

Source: Internet
Author: User
Tags min connect php and
CGI Q: What's the reason for PHP to be better than other CGI? Is there more specific data to prove that PHP performs well with other CGI execution? Now my company is using C to write CGI, if the switch to PHP, will it be better? Without strong and powerful basis, I can not convince the above people to let me into PHP ...





A:


I think "good" has to be three points


First: The written program executes fast.


Second: Performance is strong when there is a large amount of access.


Third: The program development time is fast, easy to maintain.


PHP in these three points, although not necessarily the best, but also in the forefront of





The following is a comparison of c,php and Perl in terms of speed


I test
with the following formula

$s = 1.0;


for ($i =1 $i <=10; $i + +) {


for ($j =1 $j <=10; $j + +) {


$s = $s *1.0005;


$s = $s/1.0004;


};


};


print $s;


?>


then use ab-n 10000-c http://mycgi


Test, Results

The
C language took 37.511 seconds


PHP3 in 45.393 seconds


Perl took 68.418 seconds





looks to be c the fastest yes, however, and PHP3 results are not too big


the Gap.


Perl Slowest





below is the test data


==============================================


C Language


==============================================





Document Path:/~evan/test/gcc.cgi


Document length:19 bytes





Concurrency level:20


time taken for tests:37.511 seconds


Complete requests:10000


Failed requests:0


Total transferred:1750000 bytes


HTML transferred:190000 bytes


Requests per second:266.59


Transfer rate:46.65 kb/s received





connnection Times (ms)


min avg Max


connect:0 30 3001


Processing:4 40 69


total:4 70 3070





PHP3


==============================================


Document Path:/~evan/test/php3.php3


Document length:15 bytes





Concurrency level:20


time taken for tests:45.393 seconds


Complete requests:10000


Failed requests:0


Total transferred:1710000 bytes


HTML transferred:150000 bytes


Requests per second:220.30


Transfer rate:37.67 kb/s received





connnection Times (ms)


min avg Max


connect:0 34 3039


Processing:6 53 183


Total:6 87 3222








PERL


==============================================


Document Path:/~evan/test/perl.cgi


Document length:17 bytes





Concurrency level:20


time taken for tests:68.418 seconds


Complete requests:10000


Failed requests:0


Total transferred:1730173 bytes


HTML transferred:170017 bytes


Requests per second:146.16


Transfer rate:25.29 kb/s received





connnection Times (ms)


min avg Max


connect:0 22 3005


Processing:9 112 323


Total:9 134 3328








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.