首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于HipHop的apache基准测试

基于HipHop的apache基准测试
EN

Stack Overflow用户
提问于 2011-07-11 11:28:37
回答 1查看 1.4K关注 0票数 5

最近,我用(ab)在上做了一个基准测试。

我期望PHPforPHP的结果比普通的HipHop web服务器运行得更快,但结果恰恰相反。

我用这个脚本来测试服务器,

代码语言:javascript
复制
<?php
  $i=0;
  while($i < 1000000){
    echo 'Welcome to HipHop for PHP<br />';
    $i++;
  }
?>

我使用ab命令对以下内容进行基准测试:

代码语言:javascript
复制
ab -n 500 -c 5 [URL]

我使用这个命令编译:

hphp/hphp hiphop1.php -k 1 -l 3

apache2服务器的基准测试结果:

代码语言:javascript
复制
kiddo@kiddo-VirtualBox:~/dev/hiphop-php/doc$ ab -n 500 -c 5 http://localhost/hiphop1.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests


Server Software:        Apache/2.2.16
Server Hostname:        localhost
Server Port:            80

Document Path:          /hiphop1.php
Document Length:        31000000 bytes

Concurrency Level:      5
Time taken for tests:   71.024 seconds
Complete requests:      500
Failed requests:        0
Write errors:           0
Total transferred:      15500095500 bytes
HTML transferred:       15500000000 bytes
Requests per second:    7.04 [#/sec] (mean)
Time per request:       710.240 [ms] (mean)
Time per request:       142.048 [ms] (mean, across all concurrent requests)
Transfer rate:          213122.37 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.9      0      19
Processing:   505  708  61.1    694     960
Waiting:        0    0   3.3      0      67
Total:        505  708  61.1    695     960

Percentage of the requests served within a certain time (ms)
  50%    695
  66%    714
  75%    729
  80%    736
  90%    781
  95%    857
  98%    898
  99%    938
 100%    960 (longest request)

以及HipHop的基准测试:

代码语言:javascript
复制
kiddo@kiddo-VirtualBox:~/dev/hiphop-php/doc$ ab -n 500 -c 5 http://localhost:8080/hiphop1.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests


Server Software:        
Server Hostname:        localhost
Server Port:            8080

Document Path:          /hiphop1.php
Document Length:        31000000 bytes

Concurrency Level:      5
Time taken for tests:   294.546 seconds
Complete requests:      500
Failed requests:        0
Write errors:           0
Total transferred:      15500052500 bytes
HTML transferred:       15500000000 bytes
Requests per second:    1.70 [#/sec] (mean)
Time per request:       2945.455 [ms] (mean)
Time per request:       589.091 [ms] (mean, across all concurrent requests)
Transfer rate:          51390.26 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.6      0      20
Processing:  1515 2941 579.7   2919    4734
Waiting:     1452 2626 532.5   2609    4135
Total:       1515 2941 579.7   2919    4734

Percentage of the requests served within a certain time (ms)
  50%   2919
  66%   3147
  75%   3334
  80%   3448
  90%   3704
  95%   3937
  98%   4223
  99%   4394
 100%   4734 (longest request)

问题是,为什么HipHop在我的基准测试中运行得更慢?

脚本测试有什么问题吗?

EN

回答 1

Stack Overflow用户

发布于 2012-04-25 07:40:55

PHP嘻哈加速PHP代码执行是一种常见的误解.这不一定。Facebook之所以开发它,是因为他们的整个平台都内置了几个PHP文件,而且这些文件执行得非常频繁,而且数量庞大,所以使用纯PHP是效率低下的。

使用Hop只是在PHP的执行中添加了一个步骤,您不应该像这样对‘简单’代码使用PHP。

还执行一些本机在C+中使用PHP脚本执行的函数.

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6649422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档