Преглед изворни кода

Update the hhvm test to use nginx.

(The nginx.conf is mostly copied from the php test.)
Joshua Maddux пре 10 година
родитељ
комит
ef2aab10f7

+ 9 - 9
frameworks/PHP/hhvm/URLs

@@ -1,10 +1,10 @@
-http://localhost:8080/json
-http://localhost:8080/db
-http://localhost:8080/db?queries=10
-http://localhost:8080/queries
-http://localhost:8080/queries?queries=10
-http://localhost:8080/fortunes
-http://localhost:8080/updates
-http://localhost:8080/updates?queries=10
-http://localhost:8080/plaintext
+http://localhost:8080/json.php
+http://localhost:8080/db.php
+http://localhost:8080/db.php?queries=10
+http://localhost:8080/queries.php
+http://localhost:8080/queries.php?queries=10
+http://localhost:8080/fortunes.php
+http://localhost:8080/updates.php
+http://localhost:8080/updates.php?queries=10
+http://localhost:8080/plaintext.php
 

+ 2 - 0
frameworks/PHP/hhvm/bash_profile.sh

@@ -5,3 +5,5 @@ export PHP_HOME=${IROOT}/php-5.5.17
 export PHP_FPM=$PHP_HOME/sbin/php-fpm
 
 export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"
+
+export NGINX_HOME=${IROOT}/nginx

+ 6 - 6
frameworks/PHP/hhvm/benchmark_config

@@ -4,12 +4,12 @@
     [{
       "default": {
         "setup_file"     : "setup_hhvm",
-        "json_url"       : "/json",
-        "db_url"         : "/db",
-        "query_url"      : "/queries?queries=",
-        "fortune_url"    : "/fortunes",
-        "update_url"     : "/updates?queries=",
-        "plaintext_url"  : "/plaintext",
+        "json_url"       : "/json.php",
+        "db_url"         : "/db.php",
+        "query_url"      : "/queries.php?queries=",
+        "fortune_url"    : "/fortunes.php",
+        "update_url"     : "/updates.php?queries=",
+        "plaintext_url"  : "/plaintext.php",
         "port"           : 8080,
         "approach"       : "Realistic",
         "classification" : "Platform",

+ 2 - 1
frameworks/PHP/hhvm/deploy/config-debug.hdf

@@ -5,7 +5,8 @@ PidFile = /tmp/FrameworkBenchmarks/hhvm/hhvm.pid
 
 # Server settings
 Server {
-  Port = 8080
+  Port = 9001
+  Type = fastcgi
   SourceRoot = /tmp/FrameworkBenchmarks/hhvm
   DefaultDocument = index.php
 }

+ 6 - 5
frameworks/PHP/hhvm/deploy/config.hdf

@@ -1,12 +1,13 @@
 # main configuration file
 
 # Application PID File
-PidFile = /tmp/FrameworkBenchmarks/hhvm/hhvm.pid
+PidFile = /FrameworkBenchmarks/frameworks/PHP/hhvm/hhvm.pid
 
 # Server settings
 Server {
-  Port = 8080
-  SourceRoot = /tmp/FrameworkBenchmarks/hhvm
+  Port = 9001
+  Type = fastcgi
+  SourceRoot = /home/vagrant/FrameworkBenchmarks/frameworks/PHP/hhvm
   DefaultDocument = index.php
 }
 
@@ -15,7 +16,7 @@ Log {
   UseLogFile = false
   UseSyslog = false
   Level = Error
-  #File = /tmp/FrameworkBenchmarks/hhvm/error.log
+  #File = /FrameworkBenchmarks/frameworks/PHP/hhvm/error.log
 }
 
 # Enable jit for production mode
@@ -27,7 +28,7 @@ Eval {
 # Repo file
 Repo {
   Central {
-    Path = /tmp/FrameworkBenchmarks/hhvm/.hhvm.hhbc
+    Path = /home/vagrant/FrameworkBenchmarks/frameworks/PHP/hhvm/.hhvm.bbhc
   }
 }
 

+ 136 - 0
frameworks/PHP/hhvm/deploy/nginx.conf

@@ -0,0 +1,136 @@
+#user  nobody;
+worker_processes  8;
+
+#error_log  logs/error.log;
+#error_log  logs/error.log  notice;
+#error_log  logs/error.log  info;
+error_log stderr error;
+
+#pid        logs/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /home/vagrant/FrameworkBenchmarks/installs/nginx/conf/mime.types;
+    default_type  application/octet-stream;
+
+    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+    #                  '$status $body_bytes_sent "$http_referer" '
+    #                  '"$http_user_agent" "$http_x_forwarded_for"';
+
+    #access_log  logs/access.log  main;
+    access_log off;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    #keepalive_timeout  0;
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    upstream fastcgi_backend {
+        server 127.0.0.1:9001;
+        keepalive 32;
+    }
+
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        #charset koi8-r;
+
+        #access_log  logs/host.access.log  main;
+
+        #location / {
+        #    root   html;
+        #    index  index.html index.htm;
+        #}
+
+        #error_page  404              /404.html;
+
+        # redirect server error pages to the static page /50x.html
+        #
+        #error_page   500 502 503 504  /50x.html;
+        #location = /50x.html {
+        #    root   html;
+        #}
+
+        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+        #
+        #location ~ \.php$ {
+        #    proxy_pass   http://127.0.0.1;
+        #}
+
+        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+        #
+#        location ~ \.php$ {
+#            root /home/vagrant/FrameworkBenchmarks/frameworks/PHP/php;
+#            fastcgi_pass   fastcgi_backend;
+#            fastcgi_pass 127.0.0.1:9001;
+#            fastcgi_index  index.php;
+#            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+#            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+#            fastcgi_keep_conn on;
+#            include        /home/vagrant/FrameworkBenchmarks/installs/nginx/conf/fastcgi_params;
+#        }
+        location ~ \.(hh|php)$ {
+            root /FrameworkBenchmarks/frameworks/PHP/hhvm;
+            #fastcgi_keep_conn on;
+            fastcgi_pass   fastcgi_backend;
+            #fastcgi_pass   127.0.0.1:9001;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            include        /home/vagrant/FrameworkBenchmarks/installs/nginx/conf/fastcgi_params;
+        }
+
+        # deny access to .htaccess files, if Apache's document root
+        # concurs with nginx's one
+        #
+        #location ~ /\.ht {
+        #    deny  all;
+        #}
+    }
+
+
+    # another virtual host using mix of IP-, name-, and port-based configuration
+    #
+    #server {
+    #    listen       8000;
+    #    listen       somename:8080;
+    #    server_name  somename  alias  another.alias;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+
+    # HTTPS server
+    #
+    #server {
+    #    listen       443;
+    #    server_name  localhost;
+
+    #    ssl                  on;
+    #    ssl_certificate      cert.pem;
+    #    ssl_certificate_key  cert.key;
+
+    #    ssl_session_timeout  5m;
+
+    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
+    #    ssl_ciphers  HIGH:!aNULL:!MD5;
+    #    ssl_prefer_server_ciphers   on;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+}

+ 1 - 1
frameworks/PHP/hhvm/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends php hhvm
+fw_depends nginx php hhvm

+ 2 - 0
frameworks/PHP/hhvm/run-debug.sh

@@ -1,3 +1,5 @@
 #!/bin/bash
 
 hhvm --config ./deploy/config-debug.hdf -m server
+$NGINX_HOME/sbin/nginx -c $TROOT/deploy/nginx.conf
+

+ 2 - 0
frameworks/PHP/hhvm/run.sh

@@ -1,3 +1,5 @@
 #!/bin/bash
 
 hhvm --config ./deploy/config.hdf -m server
+$NGINX_HOME/sbin/nginx -c $TROOT/deploy/nginx.conf
+

+ 2 - 1
frameworks/PHP/hhvm/setup_hhvm.sh

@@ -6,4 +6,5 @@ sed -i 's|Path = .*/.hhvm.hhbc|Path = '"${TROOT}"'/.hhvm.bbhc|g' deploy/config.h
 sed -i 's|PidFile = .*/hhvm.pid|PidFile = '"${TROOT}"'/hhvm.pid|g' deploy/config.hdf
 sed -i 's|File = .*/error.log|File = '"${TROOT}"'/error.log|g' deploy/config.hdf
 
-hhvm --config $TROOT/deploy/config.hdf -m daemon
+hhvm --config $TROOT/deploy/config.hdf -m daemon
+$NGINX_HOME/sbin/nginx -c $TROOT/deploy/nginx.conf