0

I have replaced Apache + modphp to nginx + HHVM. The original site was running between 1-2 seconds for the html document alone (from curl and FF). With HHVM it is now running at 14-20 seconds.

This is all operating on Ubuntu 14.04. With stock php.ini and 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.

jshthornton
  • 1,284
  • 11
  • 29

1 Answers1

0

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.
  • Is the time actually being spent in HHVM, or is it some nginx, mysql, etc configuration issue? top can help you figure this out, to a first approximation: which process is consuming 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. 100-200 requests should be enough.
  • 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. Folks tend to be around during working hours in the US Pacific time.
Josh Watzman
  • 7,060
  • 1
  • 18
  • 26