目前,我们已开始在生产环境中使用HHVM,到目前为止,几乎所有结果都非常令人反感.与使用APC的PHP-FPM相比,我们的整体交易率大大提高.几乎所有请求都在500毫秒以下,但是每隔几个请求(5到10个左右)就会产生2到5秒的请求时间.
请求的页面似乎没有任何区别,并且一遍又一遍地请求同一页面将在几个请求中触发此行为.
我们使用以下命令行选项在服务器模式下运行HHVM:
/usr/bin/hhvm --mode server -vServer.Type=fastcgi -vServer.FileSocket=/usr/local/PHP55/sockets/admin.sock -vPidFile=/var/run/hhvm/admin.pid -vEval.Jit=true -vServer.ThreadCount=24 -vServer.APC.EnableApc=true
我们正在为这些相关配置的网络服务器运行Nginx(对不起,如果我忘记了一些重要的东西).
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 240;
fastcgi_intercept_errors on;
服务器有128GB内存和24个内核(超线程实际上是12个).
我们在https://github.com/facebook/hhvm/wiki/Runtime-options上进行了相当多的搜索,但大多数选项都没有得到很好的解释,所以我不知道他们做了什么,在生产环境中测试它们有点可怕.
如果这里的任何人有类似的问题,或者可能指出我的方向与一些HHVM选项我会非常感激.
HipHop VM 3.0.1 (rel)
Compiler:
Repo schema: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
和/etc/hhvm/config.hdf
Log {
Level = Warning
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
}
MysqL {
TypedResults = false
}
我们正在使用supervisord启动HHVM,所以这里的主管配置如下:
[program:hhvm]
stopasgroup=true
killasgroup=true
command=/usr/bin/hhvm --mode server -vServer.Type=fastcgi -vServer.FileSocket=/usr/local/PHP55/sockets/admin.sock -vPidFile=/var/run/hhvm/admin.pid -vEval.Jit=true -vServer.ThreadCount=24 -vServer.APC.EnableApc=true
user=admin
stdout_logfile=/var/log/hhvm/admin.log
stderr_logfile=/var/log/hhvm/admin.error.log
directory=/home/admin
umask=000
/etc/hhvm/PHP.ini中有一个PHP.ini,但内容为空.所有页面都尝试了一些数据库连接,但这通常是非常小的.完整的图片也是my.cnf.使用的MysqL版本是percona
[MysqL]
# CLIENT #
port = 3306
socket = /var/lib/MysqL/MysqL.sock
[MysqLd]
# GENERAL #
user = MysqL
default-storage-engine = InnoDB
socket = /var/lib/MysqL/MysqL.sock
pid-file = /var/lib/MysqL/MysqL.pid
[MysqLd]
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 128M
max-connect-errors = 1000000
# DATA STORAGE #
datadir = /var/lib/MysqL/
# BINARY LOGGING #
log-bin = /var/lib/MysqL/MysqL-bin
expire-logs-days = 14
sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 128M
max-heap-table-size = 256M
query-cache-size = 10G
max-connections = 1000
thread-cache-size = 100
open-files-limit = 65535
table-definition-cache = 4096
table-open-cache = 4000
join-buffer-size = 1M
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-log-file-size = 512M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 73G
# LOGGING #
log-error = /var/lib/MysqL/MysqL-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/lib/MysqL/MysqL-slow.log
innodb_version 5.6.17-65.0
protocol_version 10
slave_type_conversions
version 5.6.17-65.0-56-log
version_comment Percona Server (GPL),Release 65.0,Revision 587
version_compile_machine x86_64
version_compile_os Linux