简体   繁体   English

HHVM比PHP慢

[英]HHVM Slower than PHP

I have replaced Apache + modphp to nginx + HHVM. 我已经将Apache + modphp替换为nginx + HHVM。 The original site was running between 1-2 seconds for the html document alone (from curl and FF). 仅html文档(来自curl和FF),原始站点的运行时间为1-2秒。 With HHVM it is now running at 14-20 seconds. 使用HHVM,它现在可以运行14-20秒。

This is all operating on Ubuntu 14.04. 这些都可以在Ubuntu 14.04上运行。 With stock php.ini and server.ini 带有库存的php.ini和server.ini

Here are some configs: 以下是一些配置:

location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $request_filename; // The only change
    include fastcgi_params;
}

server {
    #listen stuff
    #root stuff
    #index stuff

    location / {
        try_files $uri $uri/ index.php?$query_string;
    }

    include hhvm.conf
}

This is using CodeIgniter as the framework. 这使用CodeIgniter作为框架。

There can be lots of weird effects here that heavily depend on your app... but in general, this really shouldn't be happening. 这里可能有很多怪异的效果,在很大程度上取决于您的应用程序……但是总的来说,这确实不应该发生。 Some quick things to try: 一些快速的尝试:

  • Make sure that you're doing an apples-to-apples comparison, and aren't, for example, on another machine with MySQL configured differently/improperly, or are spending a ton of time waiting on curl requests due to a misconfigured proxy or something like that. 确保您进行的是苹果对苹果的比较,例如,不要在配置了不同/不正确的MySQL的另一台计算机上进行,或者由于代理配置不正确或正在花费大量时间等待curl请求这样的事情。
  • Is the time actually being spent in HHVM, or is it some nginx, mysql, etc configuration issue? 时间实际上是在HHVM中花费的,还是某些nginx,mysql等配置问题? top can help you figure this out, to a first approximation: which process is consuming CPU? top可以帮助您弄清楚这一点:哪个进程在消耗CPU? Or, if none of them are, where is that time going? 或者,如果都不是,那时间要去哪里?
  • Are you measuring the first request, or is it doing this under some load? 您是在测量第一个请求,还是在一定负载下进行此操作? HHVM takes some amount of time to warm up properly, and can have weird performance profiles until it does. HHVM需要花费一些时间才能正确预热,并且可能会有奇怪的性能配置文件。 100-200 requests should be enough. 100-200个请求应该足够了。
  • You can jump in #hhvm on Freenode IRC if you can't figure out what's going on, and we can help you look into it. 如果您不知道发生了什么,可以在Freenode IRC上进入#hhvm,我们可以帮助您进行调查。 Folks tend to be around during working hours in the US Pacific time. 在美国太平洋时间的工作时间内,人们通常会在附近。

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

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