Browse Source

Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks

Michael Hixson 12 years ago
parent
commit
144b8e60f7

+ 1 - 0
racket-ws/.gitignore

@@ -0,0 +1 @@
+/bench/compiled

+ 10 - 0
racket-ws/README.md

@@ -0,0 +1,10 @@
+# Racket Web Server Benchmarking Test
+
+This is the Racket Web Server portion of a
+[benchmarking test suite](../) comparing a variety of web development
+platforms.
+
+
+## Infrastructure Software Versions
+The tests were run with:
+* Racket 5.3.1

+ 0 - 0
racket-ws/__init__.py


+ 62 - 0
racket-ws/bench/bench.rkt

@@ -0,0 +1,62 @@
+#lang racket/base
+(require web-server/servlet-env
+         web-server/dispatch
+         web-server/http
+         json
+         db)
+
+(define (response/json x)
+  (response/output
+   #:mime-type #"application/json"
+   (λ (out)
+     (write-json x out))))
+
+(define (page/json req)
+  (response/json
+   (hasheq 'message "Hello, World!")))
+
+(define (go! db-host)
+  (define c
+    (virtual-connection
+     (connection-pool
+      (λ ()
+        (mysql-connect #:user "benchmarkdbuser"
+                       #:password "benchmarkdbpass"
+                       #:database "hello_world"
+                       #:server db-host)))))
+
+  (define (db-one)
+    (define random-id (add1 (random 10000)))
+    (query-list c "select * from World where randomNumber = $1" random-id))
+
+  (define (page/db req)
+    (response/json
+     (db-one)))
+
+  (define (page/dbs req i)
+    (response/json
+     (for/list ([j (in-range i)])
+       (db-one))))
+
+  (define-values (main-dispatch main-url)
+    (dispatch-rules
+     [("json")
+      page/json]
+     [("db")
+      page/db]
+     [("dbs" (integer-arg))
+      page/dbs]))
+
+  (serve/servlet
+   main-dispatch
+   #:port 8000
+   #:listen-ip #f
+   #:command-line? #t
+   #:servlet-regexp #rx""
+   #:servlet-path "/"))
+
+(module+ main
+  (require racket/cmdline)
+  (command-line #:program "bench"
+                #:args (db-host-s)
+                (go! db-host-s)))

+ 13 - 0
racket-ws/benchmark_config

@@ -0,0 +1,13 @@
+{
+  "framework": "racket-ws",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/dbs/",
+      "port": 8000,
+      "sort": 37
+    }
+  }]
+}

+ 24 - 0
racket-ws/setup.py

@@ -0,0 +1,24 @@
+
+import subprocess
+import sys
+import setup_util
+import os
+
+def start(args):
+  db_host = args.database_host
+  threads = str(args.max_threads)
+  subprocess.Popen("racket -t bench.rkt -- " + db_host + " > /dev/null", shell=True, cwd="racket-ws/bench")
+  return 0
+
+def stop():
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if 'bench' in line:
+      try:
+        pid = int(line.split(None, 2)[1])
+        os.kill(pid, 9)
+      except OSError:
+        pass
+
+  return 0

+ 3 - 3
toolset/deployment/azure/azure-deployment.sh

@@ -306,15 +306,15 @@ function azure_continue_deployment {
 information "Deploying Web Framework Benchmarks to Windows Azure..."
 information "Deploying Web Framework Benchmarks to Windows Azure..."
 echo ""
 echo ""
 
 
+azure_check_configuration
+azure_set_variables
+
 echo "The resources will be created with the base name $AZURE_DEPLOYMENT_NAME" \
 echo "The resources will be created with the base name $AZURE_DEPLOYMENT_NAME" \
 "in $AZURE_DEPLOYMENT_LOCATION under the subscription $AZURE_DEPLOYMENT_SUBSCRIPTION" \
 "in $AZURE_DEPLOYMENT_LOCATION under the subscription $AZURE_DEPLOYMENT_SUBSCRIPTION" \
 "using $AZURE_DEPLOYMENT_VM_SIZE virtual machines."
 "using $AZURE_DEPLOYMENT_VM_SIZE virtual machines."
 echo "The benchmark suite will be cloned from the $BENCHMARK_BRANCH branch of the repository at $BENCHMARK_REPOSITORY."
 echo "The benchmark suite will be cloned from the $BENCHMARK_BRANCH branch of the repository at $BENCHMARK_REPOSITORY."
 echo ""
 echo ""
 
 
-# Execute deployment steps
-azure_check_configuration
-azure_set_variables
 azure_configure_command_line_tools
 azure_configure_command_line_tools
 azure_create_common_resources
 azure_create_common_resources
 azure_create_vms
 azure_create_vms

+ 6 - 0
toolset/setup/linux/installer.py

@@ -192,6 +192,12 @@ class Installer:
     self.__run_command("chmod +x install.sh", cwd="nimrod")
     self.__run_command("chmod +x install.sh", cwd="nimrod")
     self.__run_command("sudo ./install.sh /usr/bin", cwd="nimrod")
     self.__run_command("sudo ./install.sh /usr/bin", cwd="nimrod")
 
 
+    #
+    # Racket
+    #
+
+    self.__run_command("sudo apt-get install racket", True)
+
     #######################################
     #######################################
     # Webservers
     # Webservers
     #######################################
     #######################################