简体   繁体   English

hhvm性能类似于PHP 5.5 Ubuntu 14.04

[英]hhvm performance similar to PHP 5.5 Ubuntu 14.04

I must have missed something. 我一定错过了什么。 But I'm getting the same performance with php and hhvm by running 但是我通过运行获得了与php和hhvm相同的性能
ab -n 100 -c 10 http://127.0.0.1:8080/

php -v returns: php -v返回:

HipHop VM 3.2.0 (rel)
Compiler: tags/HHVM-3.2.0-0-g01228273b8cf709aacbd3df1c51b1e690ecebac8
Repo schema: c52ba40f4a246d35a88f1dfc1daf959851ced8aa`

tail -3 /var/log/nginx/access.log returns tail -3 /var/log/nginx/access.log返回

127.0.0.1 - - [13/Sep/2014:02:46:33 +0300] "GET / HTTP/1.0" 200 116 "-" "ApacheBench/2.3"
127.0.0.1 - - [13/Sep/2014:02:46:33 +0300] "GET / HTTP/1.0" 200 116 "-" "ApacheBench/2.3"
127.0.0.1 - - [13/Sep/2014:02:46:33 +0300] "GET / HTTP/1.0" 200 116 "-" "ApacheBench/2.3"`

nginx conf: nginx conf:

location ~ \.(hh|php)$ {
                fastcgi_keep_conn on;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
 }

this is my /etc/hhvm/php.ini file: 这是我的/etc/hhvm/php.ini文件:

hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false
hhvm.eval.jit_warmup_requests = 0
hhvm.eval.jit = true

and this is my /etc/hhvm/server.ini file: 这是我的/etc/hhvm/server.ini文件:

pid = /var/run/hhvm/pid

; hhvm specific

hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.eval.jit_warmup_requests = 0
hhvm.eval.jit = true

I made sure to restart hhvm nginx and also rebooted my server. 我确保重启hhvm nginx并重启我的服务器。

I work on the HHVM team, and recently I've been looking at benchmarking. 我在HHVM团队工作,最近我一直在研究基准测试。 A few problems stand out: 一些问题突出:

  1. hhvm.eval.jit_warmup_requests = 0 - why are you setting this? hhvm.eval.jit_warmup_requests = 0 - 你为什么设置这个?
  2. Are you actually doing any warmup requests? 你真的在做任何热身请求吗? Every jit is slow for a start - I would expect php5 to beat HHVM squarely for the first 10-50 requests. 每个jit开始都很慢 - 我希望php5能够在前10-50个请求中正好击败HHVM。
  3. -n 100 -c 10 is fairly low -n 100 -c 10相当低

Benchmarking is very hard; 基准测试非常困难; I've been trying to automate a 'good' benchmark suite - you can find the work in progress here: https://github.com/facebook/hhvm/tree/master/hphp/test/frameworks/perf/ 我一直在尝试自动化一个“好”的基准测试套件 - 你可以在这里找到正在进行的工作: https//github.com/facebook/hhvm/tree/master/hphp/test/frameworks/perf/

It currently only supports wordpress, but I'm hoping to change that soon. 它目前只支持wordpress,但我希望尽快改变它。

The key things it does: 它做的关键事情:

  • runs -n 300 -c 10 as a warmup (using siege instead of ab) 运行-n 300 -c 10作为预热(使用围攻而不是ab)
  • hits multiple addresses, not just / 点击多个地址,而不仅仅是/
  • makes sure HHVM is a release build, without asserts, and has the jit turned on 确保HHVM是一个发布版本,没有断言,并打开了jit
  • makes sure PHP5 (or PHP-NG) have the opcode cache turned on 确保PHP5(或PHP-NG)启用了操作码缓存
  • runs -c 60 for 1 minute for the actual benchmark 为实际基准测试运行-c 60 1分钟

Also, what code are you trying to run? 另外,你想要运行什么代码? It's completely possible that we're actually slower at running your code; 完全可能我们在运行代码时实际上更慢; for example, we're fast at running mediawiki, but we're slow at running 'print' in a loop, fibonacci, or the other classical benchmarks. 例如,我们正在快速运行mediawiki,但我们在循环,斐波纳契或其他经典基准测试中运行'print'的速度很慢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM