我有一个运行Kohana 3.1,NGINX和PHP-FPM的应用程序。我试图用HHVM取代PHP-FPM来处理更多的请求。
代码是
public function action_test(){
echo 'Hi';
}
每秒100个请求,CPU达到200%,平均负载为15!
如果我用静态php文件替换Kohana。同一台服务器可以处理200个请求,平均负载仅为3。
使用Kohana HHVM比PHP-FPM更糟糕。我是否在配置上出错了?
Server {
Port = 9000
Type = fastcgi
SourceRoot = /mypath/to/php/repo
DefaultDocument = index.php
ThreadCount = 20
}
Eval {
Jit = true
EnableObjDestructCall = true
}
Log {
Level = Warning
UseLogFile = true
File = /var/log/hhvm/error.log
InjectedStackTrace = true
NativeStackTrace = true
NoSilencer = on
Header = on
Access {
* {
File = /var/log/hhvm/access.log
Format = %h %l %u %t \"%r\" %>s %b
}
}
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
dirindex {
pattern = ^/(.*)/$
to = $1/index.php
qsa = true
}
}
}
}
StaticFile {
FilesMatch {
* {
pattern = .*\.(dll|exe)
headers {
* = Content-Disposition: attachment
}
}
}
Extensions {
css = text/css
gif = image/gif
html = text/html
jpe = image/jpeg
jpeg = image/jpeg
jpg = image/jpeg
png = image/png
tif = image/tiff
tiff = image/tiff
txt = text/plain
}
}
ResourceLimit {
CoreFileSize = 0 # in bytes
MaxSocket = 50000 # must be not 0, otherwise HHVM will not start
SocketDefaultTimeout = 5 # in seconds
MaxRSS = 0
MaxRSSPollingCycle = 0 # in seconds, how often to check max memory
DropCacheCycle = 0 # in seconds, how often to drop disk cache
}