{"id":7875,"date":"2015-11-04T02:30:45","date_gmt":"2015-11-04T02:30:45","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/04\/hhvm-fastcgi-nginx-performance-fluctuations-open-source-projects-facebook-hhvm\/"},"modified":"2015-11-04T02:30:45","modified_gmt":"2015-11-04T02:30:45","slug":"hhvm-fastcgi-nginx-performance-fluctuations-open-source-projects-facebook-hhvm","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/04\/hhvm-fastcgi-nginx-performance-fluctuations-open-source-projects-facebook-hhvm\/","title":{"rendered":"HHVM fastcgi + Nginx performance fluctuations-open source projects facebook\/hhvm"},"content":{"rendered":"<p>Currently we started using HHVM in a production envirionment and so far almost all results are pretty inpressive. Our overall transaction rate is greatly improved compared to PHP-FPM with APC. Almost all requests are under 500ms however every couple of requests (5 to 10 or so) results in a request time of 2 to even 5 seconds.<\/p>\n<p>The page requested does not seem to make any difference and also requesting the same page over and over again will trigger this behavior within a couple of requests.<\/p>\n<p>We are running HHVM in server mode with the following command line options:<\/p>\n<pre><code>\/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\n<\/code><\/pre>\n<p>We are running nginx for the webserver with these relevant configurations (I am sorry if i forgot something importand here).<\/p>\n<pre><code>fastcgi_buffer_size 128k;\nfastcgi_buffers 256 16k;\nfastcgi_busy_buffers_size 256k;\nfastcgi_temp_file_write_size 256k;\nfastcgi_read_timeout 240;\nfastcgi_intercept_errors on;\n<\/code><\/pre>\n<p>The server has 128GB of memory and 24 cores (hyperthreading so actually 12).<\/p>\n<p>We did a fair bit of searching on https:\/\/github.com\/facebook\/hhvm\/wiki\/Runtime-options however most options aren&#8217;t explained very well so I have no idea what they do and testing them in a production environment is a bit scary.<\/p>\n<p>Had anybody here had a similar problem or could maybe point me in a direction with some of the HHVM options I would be very grateful.<\/p>\n<p>The HHVM version used is from http:\/\/www.hop5.in\/yum\/el6\/<\/p>\n<pre><code>HipHop VM 3.0.1 (rel)\nCompiler: \nRepo schema: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\n<\/code><\/pre>\n<p>And the the \/etc\/hhvm\/config.hdf<\/p>\n<pre><code>Log {\n  Level = Warning\n  AlwaysLogUnhandledExceptions = true\n  RuntimeErrorReportingLevel = 8191\n}\n\nMySQL {\n  TypedResults = false\n}\n<\/code><\/pre>\n<p>We are using supervisord to start HHVM so here the supervisor config as wel:<\/p>\n<pre><code>[program:hhvm]\nstopasgroup=true\nkillasgroup=true\ncommand=\/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 \nuser=admin\nstdout_logfile=\/var\/log\/hhvm\/admin.log\nstderr_logfile=\/var\/log\/hhvm\/admin.error.log\ndirectory=\/home\/admin\numask=000\n<\/code><\/pre>\n<p>There is a php.ini in \/etc\/hhvm\/php.ini but the content is empty. Also the pages tried all do some database connectivity but this is usually very minimal. For a complete picture also the my.cnf. The mysql version used is percona<\/p>\n<pre><code>[mysql]\n\n# CLIENT #\nport                           = 3306\nsocket                         = \/var\/lib\/mysql\/mysql.sock\n\n[mysqld]\n\n# GENERAL #\nuser                           = mysql\ndefault-storage-engine         = InnoDB\nsocket                         = \/var\/lib\/mysql\/mysql.sock\npid-file                       = \/var\/lib\/mysql\/mysql.pid\n\n[mysqld]\n\n# MyISAM #\nkey-buffer-size                = 32M\nmyisam-recover                 = FORCE,BACKUP\n\n# SAFETY #\nmax-allowed-packet             = 128M\nmax-connect-errors             = 1000000\n\n# DATA STORAGE #\ndatadir                        = \/var\/lib\/mysql\/\n\n# BINARY LOGGING #\nlog-bin                        = \/var\/lib\/mysql\/mysql-bin\nexpire-logs-days               = 14\nsync-binlog                    = 1\n\n# CACHES AND LIMITS #\ntmp-table-size                 = 128M\nmax-heap-table-size            = 256M\nquery-cache-size               = 10G\nmax-connections                = 1000\nthread-cache-size              = 100\nopen-files-limit               = 65535\ntable-definition-cache         = 4096\ntable-open-cache               = 4000\njoin-buffer-size               = 1M\n\n# INNODB #\ninnodb-flush-method            = O_DIRECT\ninnodb-log-files-in-group      = 2\ninnodb-log-file-size           = 512M\ninnodb-flush-log-at-trx-commit = 1\ninnodb-file-per-table          = 1\ninnodb-buffer-pool-size        = 73G\n\n# LOGGING #\nlog-error                      = \/var\/lib\/mysql\/mysql-error.log\nlog-queries-not-using-indexes  = 1\nslow-query-log                 = 1\nslow-query-log-file            = \/var\/lib\/mysql\/mysql-slow.log\n<\/code><\/pre>\n<p>Mysql version:<\/p>\n<pre><code>innodb_version  5.6.17-65.0\nprotocol_version    10\nslave_type_conversions  \nversion 5.6.17-65.0-56-log\nversion_comment Percona Server (GPL), Release 65.0, Revision 587\nversion_compile_machine x86_64\nversion_compile_os  Linux\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Currently we started using HHVM in a production envirionment and so far almost all results are pretty inpressive. Our overall transaction rate is greatly improved compared to PHP-FPM with APC. Almost all requests are under 500ms however every couple of requests (5 to 10 or so) results in a request time of 2 to even [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7875","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7875"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7875\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}