Parcourir la source

Merge remote-tracking branch 'te/master' into php_5.5.17_upgrade

Greg Hellings il y a 11 ans
Parent
commit
1cd0be91e6

+ 1 - 0
deployment/vagrant-common/bootstrap.sh

@@ -90,6 +90,7 @@ if [ ! -e "~/.firstboot" ]; then
 
   # Install prerequisite tools
   echo "Installing prerequisites"
+  sudo apt-get update
   sudo apt-get install -y git
   sudo apt-get install -y python-pip
 

+ 13 - 1
deployment/vagrant-virtualbox/README.md

@@ -9,4 +9,16 @@ that modify how TFB launches your Virtuabox virtual machines.
 | `TFB_VB_SHOW`                    | `true,false`        | Show the VM in a window when running? Default is false
 | `TFB_VB_ARCH`                    | `64,32`             | Used to force TFB to run a 32-bit virtual machine. This is unsupported, as many of the framework binaries we download are 64-bit only and will not launch. If you cannot run a 64-bit VM, then we recommend using the Amazon AWS provider instead of using this variable
 | `TFB_VB_MEM`                     | `<number>` e.g. `2048` | Size of VM's RAM in MB. Default is `2048`
-| `TFB_VB_CPU`                     | `<number>` e.g. `2` | Number of host CPUs that the VM can access
+| `TFB_VB_CPU`                     | `<number>` e.g. `2` | Number of host CPUs that the VM can access
+
+# Tips and Tricks
+
+**Use Snapshots To Speed Development**
+
+There is an excellent Vagrant plugin to perform  
+snapshots [here](https://github.com/scalefactory/vagrant-multiprovider-snap). 
+Another alternative is [here](https://github.com/dergachev/vagrant-vbox-snapshot).
+My standard workflow is to do `vagrant up` and immediately 
+do a `vagrant snap` to preserve the initial state. Then I can
+install things, work on pull requests, etc, and roll back to the 
+initial state each time to avoid interference. 

+ 4 - 4
frameworks/Dart/dart/README.md

@@ -4,12 +4,12 @@ This is the dart portion of a [benchmarking test suite](../) comparing a variety
 
 ## Versions
 
-* [Dart SDK version >=1.3.0](http://www.dartlang.org/)
-* [Dart args version 0.11.0+1](http://pub.dartlang.org/packages/args)
+* [Dart SDK version >=1.6.0](http://www.dartlang.org/)
+* [Dart args version 0.12.0+2](http://pub.dartlang.org/packages/args)
 * [Dart crypto version 0.9.0](http://pub.dartlang.org/packages/crypto)
 * [Dart mustache version 0.1.8](http://pub.dartlang.org/packages/mustache)
-* [Dart postgresql version 0.2.13](http://pub.dartlang.org/packages/postgresql)
-* [Dart yaml version 0.9.0](http://pub.dartlang.org/packages/yaml)
+* [Dart postgresql version 0.2.14](http://pub.dartlang.org/packages/postgresql)
+* [Dart yaml version 2.0.1+1](http://pub.dartlang.org/packages/yaml)
 
 ## Test URLs
 

+ 1 - 1
frameworks/Dart/dart/benchmark_config

@@ -17,7 +17,7 @@
       "language": "Dart",
       "orm": "Raw",
       "platform": "Dart",
-      "webserver": "nginx",
+      "webserver": "None",
       "os": "Linux",
       "database_os": "Linux",
       "display_name": "dart",

+ 1 - 1
frameworks/Dart/dart/install.sh

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

+ 4 - 4
frameworks/Dart/dart/pubspec.yaml

@@ -1,10 +1,10 @@
 name: dartbenchmark
 description: A benchmark of dart
 environment:
-  sdk: ">=1.3.0 <2.0.0"
+  sdk: '>=1.6.0 <2.0.0'
 dependencies:
-  args: 0.11.0+1
+  args: 0.12.0+2
   crypto: 0.9.0
   mustache: 0.1.8
-  postgresql: 0.2.13
-  yaml: 0.9.0
+  postgresql: 0.2.14
+  yaml: 2.0.1+1

+ 53 - 45
frameworks/Dart/dart/server.dart

@@ -1,6 +1,7 @@
 import 'dart:async' show Future;
-import 'dart:io';
 import 'dart:convert';
+import 'dart:io';
+import 'dart:isolate';
 import 'dart:math' show Random;
 import 'package:args/args.dart' show ArgParser;
 import 'package:mustache/mustache.dart' as mustache;
@@ -17,11 +18,26 @@ main(List<String> args) {
   parser.addOption('address', abbr: 'a', defaultsTo: '0.0.0.0');
   parser.addOption('port', abbr: 'p', defaultsTo: '8080');
   parser.addOption('dbconnections', abbr: 'd', defaultsTo: '256');
+  parser.addOption('isolates', abbr: 'i', defaultsTo: '1');
   var arguments = parser.parse(args);
-  _startServer(
-      arguments['address'],
-      int.parse(arguments['port']),
-      int.parse(arguments['dbconnections']));
+  var isolates = int.parse(arguments['isolates']);
+  var dbConnections = int.parse(arguments['dbconnections']) ~/ isolates;
+  ServerSocket.bind(arguments['address'], int.parse(arguments['port']))
+      .then((server) {
+        var ref = server.reference;
+        for (int i = 1; i < isolates; i++) {
+          Isolate.spawn(startInIsolate, [ref, dbConnections]);
+        }
+        _startServer(server, dbConnections);
+      });
+}
+
+void startInIsolate(args) {
+  var ref = args[0];
+  var dbConnections = args[1];
+  ref.create().then((server) {
+    _startServer(server, dbConnections);
+  });
 }
 
 /// The entity used in the database query and update tests.
@@ -51,15 +67,6 @@ const _WORLD_TABLE_SIZE = 10000;
 /// A random number generator.
 final _RANDOM = new Random();
 
-/// The 'text/html; charset=utf-8' content type.
-final _TYPE_HTML = new ContentType('text', 'html', charset: 'utf-8');
-
-/// The 'application/json' content type.
-final _TYPE_JSON = new ContentType('application', 'json');
-
-/// The 'text/html; charset=utf-8' content type.
-final _TYPE_TEXT = new ContentType('text', 'plain', charset: 'utf-8');
-
 /// The PostgreSQL connection pool used by all the tests that require database
 /// connectivity.
 var _connectionPool;
@@ -70,7 +77,7 @@ var _fortunesTemplate;
 /// Starts a benchmark server, which listens for connections from
 /// '[address] : [port]' and maintains [dbConnections] connections to the
 /// database.
-_startServer(address, port, dbConnections) {
+_startServer(serverSocket, dbConnections) {
   Future.wait([
     new File('postgresql.yaml').readAsString().then((config) {
       _connectionPool = new pgpool.Pool(
@@ -83,33 +90,33 @@ _startServer(address, port, dbConnections) {
       _fortunesTemplate = mustache.parse(template);
     })
   ]).then((_) {
-    HttpServer.bind(address, port).then((server) {
-      server.serverHeader = 'dart';
-      server.listen((request) {
-        switch (request.uri.path) {
-          case '/json':
-            _jsonTest(request);
-            break;
-          case '/db':
-            _dbTest(request);
-            break;
-          case '/queries':
-            _queriesTest(request);
-            break;
-          case '/fortunes':
-            _fortunesTest(request);
-            break;
-          case '/updates':
-            _updatesTest(request);
-            break;
-          case '/plaintext':
-            _plaintextTest(request);
-            break;
-          default:
-            _sendResponse(request, HttpStatus.NOT_FOUND);
-            break;
-        }
-      });
+    var server = new HttpServer.listenOn(serverSocket);
+    server.defaultResponseHeaders.clear();
+    server.serverHeader = 'dart';
+    server.listen((request) {
+      switch (request.uri.path) {
+        case '/json':
+          _jsonTest(request);
+          break;
+        case '/db':
+          _dbTest(request);
+          break;
+        case '/queries':
+          _queriesTest(request);
+          break;
+        case '/fortunes':
+          _fortunesTest(request);
+          break;
+        case '/updates':
+          _updatesTest(request);
+          break;
+        case '/plaintext':
+          _plaintextTest(request);
+          break;
+        default:
+          _sendResponse(request, HttpStatus.NOT_FOUND);
+          break;
+      }
     });
   });
 }
@@ -140,17 +147,18 @@ _sendResponse(request, statusCode, [ type, response ]) {
 
 /// Completes the given [request] by writing the [response] as HTML.
 _sendHtml(request, response) {
-  _sendResponse(request, HttpStatus.OK, _TYPE_HTML, response);
+  _sendResponse(request, HttpStatus.OK, ContentType.HTML, response);
 }
 
 /// Completes the given [request] by writing the [response] as JSON.
 _sendJson(request, response) {
-  _sendResponse(request, HttpStatus.OK, _TYPE_JSON, JSON.encode(response));
+  _sendResponse(
+      request, HttpStatus.OK, ContentType.JSON, JSON.encode(response));
 }
 
 /// Completes the given [request] by writing the [response] as plain text.
 _sendText(request, response) {
-  _sendResponse(request, HttpStatus.OK, _TYPE_TEXT, response);
+  _sendResponse(request, HttpStatus.OK, ContentType.TEXT, response);
 }
 
 /// Responds with the JSON test to the [request].

+ 1 - 44
frameworks/Dart/dart/setup.py

@@ -13,55 +13,12 @@ def start(args, logfile, errfile):
     #
     # start dart servers
     #
-    for port in range(9001, 9001 + args.max_threads):
-      subprocess.Popen('dart server.dart -a 127.0.0.1 -p ' + str(port) + ' -d ' + str(args.max_concurrency / args.max_threads), shell=True, cwd='dart', stderr=errfile, stdout=logfile)
-    #
-    # create nginx configuration
-    #
-    conf = []
-    conf.append('worker_processes ' + str(args.max_threads) + ';')
-    conf.append('error_log stderr error;')
-    conf.append('events {')
-    conf.append('    worker_connections 1024;')
-    conf.append('}')
-    conf.append('http {')
-    conf.append('    access_log off;')
-    conf.append('    include /usr/local/nginx/conf/mime.types;')
-    conf.append('    default_type application/octet-stream;')
-    conf.append('    sendfile on;')
-    conf.append('    upstream dart_cluster {')
-    for port in range(9001, 9001 + args.max_threads):
-      conf.append('        server 127.0.0.1:' + str(port) + ';')
-    conf.append('        keepalive ' + str(args.max_concurrency / args.max_threads) + ';')
-    conf.append('    }')
-    conf.append('    server {')
-    conf.append('        listen 8080;')
-    conf.append('        location / {')
-    conf.append('            proxy_pass http://dart_cluster;')
-    conf.append('            proxy_http_version 1.1;')
-    conf.append('            proxy_set_header Connection "";')
-    conf.append('        }')
-    conf.append('    }')
-    conf.append('}')
-    #
-    # write nginx configuration to disk
-    #
-    with open('dart/nginx.conf', 'w') as f:
-      f.write('\n'.join(conf))
-    #
-    # start nginx
-    #
-    subprocess.Popen('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf', shell=True, cwd='dart', stderr=errfile, stdout=logfile);
+    subprocess.Popen('dart server.dart -a 0.0.0.0 -p 8080 -d ' + str(args.max_concurrency) + ' -i ' + str(args.max_threads), shell=True, cwd='dart', stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 
 def stop(logfile, errfile):
-  #
-  # stop nginx
-  #
-  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd='dart', stderr=errfile, stdout=logfile)
-  os.remove('dart/nginx.conf')
   #
   # stop dart servers
   #

+ 1 - 1
frameworks/Java/curacao/README.md

@@ -4,7 +4,7 @@ Curacao is an open-source toolkit for building REST/HTTP-based integration layer
 
 ## Versions
 
-Curacao 2.6.2
+Curacao 2.6.3
 https://github.com/markkolich/curacao
 
 ## Tests

+ 3 - 3
frameworks/Java/curacao/build.sbt

@@ -13,9 +13,9 @@ resolvers ++= Seq(
 )
 
 libraryDependencies ++= Seq(
-  "com.kolich.curacao" % "curacao" % "2.6.2" % "compile",
-  "com.kolich.curacao" % "curacao-gson" % "2.6.2" % "compile",
-  "org.eclipse.jetty" % "jetty-webapp" % "9.2.0.v20140526" % "compile",
+  "com.kolich.curacao" % "curacao" % "2.6.3" % "compile",
+  "com.kolich.curacao" % "curacao-gson" % "2.6.3" % "compile",
+  "org.eclipse.jetty" % "jetty-webapp" % "9.2.3.v20140905" % "compile",
   "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided",
   "org.slf4j" % "slf4j-api" % "1.7.2" % "compile",
   "ch.qos.logback" % "logback-core" % "1.0.7" % "compile",

+ 7 - 4
frameworks/Lua/lapis/config.lua

@@ -3,12 +3,15 @@ do
   local _obj_0 = require("lapis.config")
   config = _obj_0.config
 end
-config("development", function()
-  return postgresql_url("postgres://benchmarkdbuser:[email protected]/hello_world")
-end)
+config("development", function() end)
 return config("production", function()
   port(80)
   num_workers(4)
   lua_code_cache("on")
-  return postgresql_url("postgres://benchmarkdbuser:[email protected]/hello_world")
+  return postgres({
+    backend = "pgmoon",
+    database = "hello_world",
+    user = "postgres",
+    host = "DBHOSTNAME"
+  })
 end)

+ 6 - 2
frameworks/Lua/lapis/config.moon

@@ -1,10 +1,14 @@
 import config from require "lapis.config"
 
 config "development", ->
-  postgresql_url "postgres://benchmarkdbuser:[email protected]/hello_world"
 
 config "production", ->
   port 80
   num_workers 4
   lua_code_cache "on"
-  postgresql_url "postgres://benchmarkdbuser:[email protected]/hello_world"
+  postgres {
+    backend: "pgmoon"
+    database: "hello_world"
+    user: "postgres"
+    host: "DBHOSTNAME"
+  }

+ 1 - 0
frameworks/Lua/lapis/setup.py

@@ -4,6 +4,7 @@ import setup_util
 import os
 
 def start(args, logfile, errfile):
+  setup_util.replace_text("lapis/config.lua", "DBHOSTNAME", args.database_host)
   setup_util.replace_text("lapis/nginx.conf", "DBHOSTNAME", args.database_host)
   #subprocess.Popen('/usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
   subprocess.Popen('lapis server production', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)

+ 4 - 3
frameworks/Lua/lapis/web.lua

@@ -23,8 +23,7 @@ end
 local min, random
 do
   local _obj_0 = math
-  min = _obj_0.min
-  random = _obj_0.random
+  min, random = _obj_0.min, _obj_0.random
 end
 local Fortune
 do
@@ -117,6 +116,7 @@ do
         }
       end
       local worlds = { }
+      num_queries = min(500, num_queries)
       for i = 1, num_queries do
         local w = World:find(random(1, 10000))
         insert(worlds, {
@@ -178,7 +178,8 @@ do
         num_queries = 1
       end
       local worlds = { }
-      for i = 1, min(500, num_queries) do
+      num_queries = min(500, num_queries)
+      for i = 1, num_queries do
         local wid = random(1, 10000)
         local world = World:find(wid)
         world.randomnumber = random(1, 10000)

+ 3 - 1
frameworks/Lua/lapis/web.moon

@@ -21,6 +21,7 @@ class Benchmark extends lapis.Application
       return json: {id:w.id,randomNumber:w.randomnumber}
 
     worlds = {}
+    num_queries = min(500, num_queries)
     for i = 1, num_queries
       w = World\find random(1, 10000)
       insert worlds, {id:w.id,randomNumber:w.randomnumber} 
@@ -55,7 +56,8 @@ class Benchmark extends lapis.Application
     if num_queries == 0
       num_queries = 1
     worlds = {}
-    for i = 1, min(500, num_queries)
+    num_queries = min(500, num_queries)
+    for i = 1, num_queries
       wid = random(1, 10000)
       world = World\find wid
       world.randomnumber = random(1, 10000)

+ 2 - 0
frameworks/Lua/openresty/app.lua

@@ -2,6 +2,7 @@ local mysql = mysql
 
 local encode = encode
 local random = math.random
+local min = math.min
 
 local mysqlconn = {
 	host = "DBHOSTNAME",
@@ -23,6 +24,7 @@ return function(ngx)
 		ngx.print(encode(db:query('SELECT * FROM World WHERE id = '..random(1,10000))[1]))
 	else
 		local worlds = {}
+		num_queries = min(500, num_queries)
 		for i=1, num_queries do
 			worlds[#worlds+1] = db:query('SELECT * FROM World WHERE id = '..random(1,10000))[1]
 		end

+ 5 - 5
toolset/setup/linux/webservers/openresty.sh

@@ -5,12 +5,12 @@ RETCODE=$(fw_exists openresty.installed)
 
 fw_depends nginx lua
 
-fw_get http://openresty.org/download/ngx_openresty-1.5.12.1.tar.gz
-fw_untar ngx_openresty-1.5.12.1.tar.gz
+fw_get http://openresty.org/download/ngx_openresty-1.7.4.1.tar.gz
+fw_untar ngx_openresty-1.7.4.1.tar.gz
 
-cd ngx_openresty-1.5.12.1
-./configure --with-luajit-xcflags=-DLUAJIT_NUMMODE=2 --with-cc-opt=-O2 --with-http_postgres_module -j4
+cd ngx_openresty-1.7.4.1
+./configure --with-luajit-xcflags=-DLUAJIT_NUMMODE=2 --with-http_postgres_module -j4
 make -j4
 sudo make install
 
-touch $IROOT/openresty.installed
+touch $IROOT/openresty.installed