Browse Source

aqueduct, angel and redstone removed (#6509)

* aqueduct and angel removed

* redstone removed
Francesco Iapicca 4 years ago
parent
commit
7dae68ecf0
37 changed files with 0 additions and 1352 deletions
  1. 0 6
      frameworks/Dart/angel/.gitignore
  2. 0 39
      frameworks/Dart/angel/README.md
  3. 0 11
      frameworks/Dart/angel/angel-postgres.dockerfile
  4. 0 11
      frameworks/Dart/angel/angel.dockerfile
  5. 0 55
      frameworks/Dart/angel/benchmark_config.json
  6. 0 72
      frameworks/Dart/angel/bin/main.dart
  7. 0 36
      frameworks/Dart/angel/config.toml
  8. 0 6
      frameworks/Dart/angel/config/default.yaml
  9. 0 1
      frameworks/Dart/angel/config/production.yaml
  10. 0 138
      frameworks/Dart/angel/lib/dart_angel_benchmark.dart
  11. 0 9
      frameworks/Dart/angel/lib/src/models/fortune.dart
  12. 0 2
      frameworks/Dart/angel/lib/src/models/models.dart
  13. 0 9
      frameworks/Dart/angel/lib/src/models/world.dart
  14. 0 37
      frameworks/Dart/angel/lib/src/query/mongo.dart
  15. 0 41
      frameworks/Dart/angel/lib/src/query/postgres.dart
  16. 0 10
      frameworks/Dart/angel/lib/src/query/querier.dart
  17. 0 3
      frameworks/Dart/angel/lib/src/query/query.dart
  18. 0 18
      frameworks/Dart/angel/pubspec.yaml
  19. 0 1
      frameworks/Dart/angel/views/fortunes.mustache
  20. 0 37
      frameworks/Dart/aqueduct/README.md
  21. 0 9
      frameworks/Dart/aqueduct/aqueduct.dockerfile
  22. 0 28
      frameworks/Dart/aqueduct/benchmark_config.json
  23. 0 19
      frameworks/Dart/aqueduct/config.toml
  24. 0 6
      frameworks/Dart/aqueduct/config.yaml
  25. 0 20
      frameworks/Dart/aqueduct/fortunes.mustache
  26. 0 11
      frameworks/Dart/aqueduct/pubspec.yaml
  27. 0 227
      frameworks/Dart/aqueduct/server.dart
  28. 0 65
      frameworks/Dart/redstone/README.md
  29. 0 49
      frameworks/Dart/redstone/benchmark_config.json
  30. 0 34
      frameworks/Dart/redstone/config.toml
  31. 0 20
      frameworks/Dart/redstone/fortunes.mustache
  32. 0 2
      frameworks/Dart/redstone/mongodb.yaml
  33. 0 5
      frameworks/Dart/redstone/postgresql.yaml
  34. 0 15
      frameworks/Dart/redstone/pubspec.yaml
  35. 0 14
      frameworks/Dart/redstone/redstone-mongodb.dockerfile
  36. 0 14
      frameworks/Dart/redstone/redstone.dockerfile
  37. 0 272
      frameworks/Dart/redstone/server.dart

+ 0 - 6
frameworks/Dart/angel/.gitignore

@@ -1,6 +0,0 @@
-!bin/
-.dart_tool
-.packages
-*.reflectable.dart
-*.g.part
-*.g.dart

+ 0 - 39
frameworks/Dart/angel/README.md

@@ -1,39 +0,0 @@
-# Angel Framework Benchmarking Test
-This test adds [Angel](https://angel-dart.github.io),
-a full-featured framework for Dart, to the
-[benchmarking test suite](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Dart). The test is based on the Dart Benchmarking Test.
-
-## Versions
-The `pubspec.lock` file is included; so that dependencies are kept consistent between deployments.
-The tests included in this benchmark are a demonstration of:
-* [Dart SDK version 2.2.0](http://www.dartlang.org/)
-* [Angel Framework version `^2.0.0-alpha.22`](https://pub.dartlang.org/packages/angel_framework/versions/2.0.0-alpha.22)
-
-## Test URLs
-### JSON
-
-http://localhost:8080/json
-
-### PLAINTEXT
-
-http://localhost:8080/plaintext
-
-### DB
-
-http://localhost:8080/db
-
-### QUERY
-
-http://localhost:8080/query?queries=
-
-### CACHED QUERY
-
-http://localhost:8080/cached_query?queries=
-
-### UPDATE
-
-http://localhost:8080/update?queries=
-
-### FORTUNES
-
-http://localhost:8080/fortunes

+ 0 - 11
frameworks/Dart/angel/angel-postgres.dockerfile

@@ -1,11 +0,0 @@
-FROM google/dart:2.2
-
-COPY ./ ./
-
-RUN pub get
-
-RUN pub run build_runner build
-
-EXPOSE 8080
-
-CMD ANGEL_ENV=production dart bin/main.dart --type=postgres

+ 0 - 11
frameworks/Dart/angel/angel.dockerfile

@@ -1,11 +0,0 @@
-FROM google/dart:2.2
-
-COPY ./ ./
-
-RUN pub get
-
-RUN pub run build_runner build
-
-EXPOSE 8080
-
-CMD ANGEL_ENV=production dart bin/main.dart --type=mongo

+ 0 - 55
frameworks/Dart/angel/benchmark_config.json

@@ -1,55 +0,0 @@
-{
-  "framework": "angel",
-  "tests": [
-    {
-      "default": {
-        "json_url": "/json",
-        "plaintext_url": "/plaintext",
-        "db_url": "/db",
-        "query_url": "/queries/?queryCount=",
-        "update_url": "/updates/?queryCount=",
-        "fortune_url": "/fortunes",
-        "port": 8080,
-        "approach": "Realistic",
-        "classification": "Fullstack",
-        "database": "mongodb",
-        "framework": "angel-mongo",
-        "language": "Dart",
-        "flavor": "None",
-        "orm": "Raw",
-        "platform": "None",
-        "webserver": "None",
-        "os": "Linux",
-        "database_os": "Linux",
-        "display_name": "Angel (MongoDB)",
-        "notes": "",
-        "versus": "dart",
-        "tags": ["broken"]
-      },
-      "postgres": {
-        "json_url": "/json",
-        "plaintext_url": "/plaintext",
-        "db_url": "/db",
-        "query_url": "/queries/?queryCount=",
-        "update_url": "/updates/?queryCount=",
-        "fortune_url": "/fortunes",
-        "port": 8080,
-        "approach": "Realistic",
-        "classification": "Fullstack",
-        "database": "postgres",
-        "framework": "angel-postgres",
-        "language": "Dart",
-        "flavor": "None",
-        "orm": "Raw",
-        "platform": "None",
-        "webserver": "None",
-        "os": "Linux",
-        "database_os": "Linux",
-        "display_name": "Angel (MongoDB)",
-        "notes": "",
-        "versus": "dart",
-        "tags": ["broken"]
-      }
-    }
-  ]
-}

+ 0 - 72
frameworks/Dart/angel/bin/main.dart

@@ -1,72 +0,0 @@
-import 'dart:async';
-import 'dart:io';
-import 'dart:isolate';
-import 'package:angel_framework/angel_framework.dart';
-import 'package:angel_framework/http.dart';
-import 'package:args/args.dart';
-import 'package:dart_angel_benchmark/dart_angel_benchmark.dart'
-    as dart_angel_benchmark;
-import 'main.reflectable.dart';
-
-main(List<String> args) async {
-  initializeReflectable();
-  var argParser = ArgParser()
-    ..addOption('type',
-        abbr: 't', allowed: ['mongo', 'postgres'], defaultsTo: 'mongo');
-
-  try {
-    var argResults = argParser.parse(args);
-    serverMain(StartConfig(0, argResults));
-
-    for (int i = 1; i < Platform.numberOfProcessors; i++) {
-      var onError = new ReceivePort();
-      onError.first.then((data) {
-        print(data);
-
-        if (data is List) {
-          Zone.current.errorCallback(data[0], data[1] as StackTrace);
-        }
-      });
-      Isolate.spawn(serverMain, StartConfig(i, argResults),
-          onError: onError.sendPort);
-    }
-  } on ArgParserException catch (e) {
-    stderr
-      ..writeln('fatal error: ${e.message}')
-      ..writeln('usage: bin/main.dart [options...]')
-      ..writeln()
-      ..writeln(argParser.usage);
-    exitCode = 1;
-  }
-}
-
-void serverMain(StartConfig config) {
-  var app = Angel(
-      //logger: Logger('tfb'),
-      );
-
-  // hierarchicalLoggingEnabled = true;
-
-  //app.logger.onRecord.listen((rec) {
-  //  print(rec);
-  //  if (rec.error != null) print(rec.error);
-  //  if (rec.stackTrace != null) print(rec.stackTrace);
-  //});
-
-  app
-      .configure(dart_angel_benchmark.configureServer(config.argResults))
-      .then((_) async {
-    var http = AngelHttp.custom(app, startShared);
-    var server = await http.startServer('0.0.0.0', 8080);
-    var url =
-        Uri(scheme: 'http', host: server.address.address, port: server.port);
-    print('Instance #${config.id} listening at $url');
-  });
-}
-
-class StartConfig {
-  final int id;
-  final ArgResults argResults;
-
-  StartConfig(this.id, this.argResults);
-}

+ 0 - 36
frameworks/Dart/angel/config.toml

@@ -1,36 +0,0 @@
-[framework]
-name = "angel"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries/?queryCount="
-urls.update = "/updates/?queryCount="
-urls.fortune = "/fortunes"
-approach = "Realistic"
-classification = "Fullstack"
-database = "mongodb"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "None"
-webserver = "None"
-versus = "dart"
-
-[postgres]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries/?queryCount="
-urls.update = "/updates/?queryCount="
-urls.fortune = "/fortunes"
-approach = "Realistic"
-classification = "Fullstack"
-database = "postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "None"
-webserver = "None"
-versus = "dart"

+ 0 - 6
frameworks/Dart/angel/config/default.yaml

@@ -1,6 +0,0 @@
-postgres:
-  username: benchmarkdbuser
-  password: benchmarkdbpass
-  host: tfb-database
-  port: 5432
-  databaseName: hello_world

+ 0 - 1
frameworks/Dart/angel/config/production.yaml

@@ -1 +0,0 @@
-mongo_db: "mongodb://tfb-database/hello_world"

+ 0 - 138
frameworks/Dart/angel/lib/dart_angel_benchmark.dart

@@ -1,138 +0,0 @@
-import 'dart:async';
-import 'dart:io';
-import 'dart:math';
-import 'package:angel_configuration/angel_configuration.dart';
-import 'package:angel_framework/angel_framework.dart';
-import 'package:args/args.dart';
-import 'package:file/local.dart';
-import 'package:http_parser/http_parser.dart';
-import 'package:mongo_dart/mongo_dart.dart';
-import 'package:mustache4dart/mustache4dart.dart' as mustache;
-import 'package:postgres/postgres.dart';
-import 'src/models/models.dart';
-import 'src/query/query.dart';
-
-AngelConfigurer configureServer(ArgResults argResults) {
-  var rnd = new Random();
-  var minQueryCount = 1;
-  var maxQueryCount = 500;
-  var worldTableSize = 10000;
-  var fs = const LocalFileSystem();
-
-  return (Angel app) async {
-    // Load configuration.
-    await app.configure(configuration(fs));
-
-    // Set up the view engine.
-    var fortunesTemplate =
-        await fs.file('views/fortunes.mustache').readAsString();
-
-    app.viewGenerator =
-        (name, [data]) => mustache.render(fortunesTemplate, data);
-
-    // Select a querier, either MongoDB or PostgreSQL.
-    //
-    // Either way, the container *must* contain a `Querier`.
-    if (argResults['type'] == 'mongo') {
-      var db = Db(app.configuration['mongo_db']);
-      app.container
-          .registerSingleton<Querier>(MongoQuerier(db, rnd, worldTableSize));
-      await db.open();
-      app.shutdownHooks.add((_) => db.close());
-    } else if (argResults['type'] == 'postgres') {
-      var postgresConfig = app.configuration['postgres'] as Map;
-      var connection = PostgreSQLConnection(
-        postgresConfig['host'],
-        postgresConfig['port'],
-        postgresConfig['databaseName'],
-        username: postgresConfig['username'],
-        password: postgresConfig['password'],
-      );
-      app.container.registerSingleton<Querier>(PostgresQuerier(connection));
-      await connection.open();
-      app.shutdownHooks.add((_) => connection.close());
-    } else {
-      throw UnsupportedError('Unsupported DB ${argResults['type']}');
-    }
-
-    // Always add a Date header.
-    app.fallback((req, res) {
-      res.headers['date'] = HttpDate.format(DateTime.now());
-    });
-
-    // JSON response.
-    app.get('/json', (req, res) {
-      res.serialize({'message': 'Hello, World!'});
-    });
-
-    // Plaintext response.
-    app.get('/plaintext', (req, res) {
-      res
-        ..write('Hello, World!')
-        ..close();
-    });
-
-    // Fetch random world object.
-    app.get('/db', (req, res) async {
-      var querier = req.container.make<Querier>();
-      res.serialize(await querier.getRandomWorld());
-    });
-
-    // DB queries
-    app.get('/queries', (req, res) async {
-      // Get the querier and query count.
-      var querier = req.container.make<Querier>();
-      var queryCount =
-          int.tryParse(req.uri.queryParameters['queryCount'].toString()) ??
-              minQueryCount;
-      queryCount = queryCount.clamp(minQueryCount, maxQueryCount);
-
-      // Fetch the objects.
-      var worlds = await Future.wait<World>(
-          List.generate(queryCount, (_) => querier.getRandomWorld()));
-      res.serialize(worlds);
-    });
-
-    // DB updates
-    app.get('/updates', (req, res) async {
-      // Get the querier and query count.
-      var querier = req.container.make<Querier>();
-      var queryCount =
-          int.tryParse(req.uri.queryParameters['queryCount'].toString()) ??
-              minQueryCount;
-      queryCount = queryCount.clamp(minQueryCount, maxQueryCount);
-
-      // Fetch the objects.
-      var worlds =
-          await Future.wait<World>(List.generate(queryCount, (_) async {
-        var world = await querier.getRandomWorld();
-        world = world.copyWith(randomNumber: rnd.nextInt(worldTableSize) + 1);
-        await querier.updateWorld(world.id, world);
-        return world;
-      }));
-      res.serialize(worlds);
-    });
-
-    // Templating
-    app.get('/fortunes', (req, res) async {
-      var querier = req.container.make<Querier>();
-      var fortunes = await querier.getFortunes();
-
-      // Insert an additional fortune.
-      fortunes.add(
-        Fortune(
-          id: 0,
-          message: 'Additional fortune added at request time.',
-        ),
-      );
-
-      // Sort the fortunes.
-      fortunes.sort((a, b) => a.message.compareTo(b.message));
-
-      // Render the template.
-      res.contentType = new MediaType('text', 'html', {'charset': 'utf-8'});
-      await res.render('fortunes',
-          {'fortunes': fortunes.map((f) => f.copyWith(id: f.id.toInt()))});
-    });
-  };
-}

+ 0 - 9
frameworks/Dart/angel/lib/src/models/fortune.dart

@@ -1,9 +0,0 @@
-import 'package:angel_serialize/angel_serialize.dart';
-part 'fortune.g.dart';
-
-@Serializable(autoSnakeCaseNames: false)
-abstract class _Fortune {
-  num get id;
-
-  String get message;
-}

+ 0 - 2
frameworks/Dart/angel/lib/src/models/models.dart

@@ -1,2 +0,0 @@
-export 'fortune.dart';
-export 'world.dart';

+ 0 - 9
frameworks/Dart/angel/lib/src/models/world.dart

@@ -1,9 +0,0 @@
-import 'package:angel_serialize/angel_serialize.dart';
-part 'world.g.dart';
-
-@Serializable(autoSnakeCaseNames: false)
-abstract class _World {
-  num get id;
-
-  num get randomNumber;
-}

+ 0 - 37
frameworks/Dart/angel/lib/src/query/mongo.dart

@@ -1,37 +0,0 @@
-import 'dart:async';
-import 'dart:math';
-import 'package:dart_angel_benchmark/src/models/fortune.dart';
-import 'package:mongo_dart/mongo_dart.dart';
-import '../models/models.dart';
-import 'querier.dart';
-
-class MongoQuerier implements Querier {
-  final Db db;
-  final Random rnd;
-  final int worldTableSize;
-  DbCollection _fortunes, _worlds;
-
-  MongoQuerier(this.db, this.rnd, this.worldTableSize) {
-    _fortunes = db.collection('fortune');
-    _worlds = db.collection('world');
-  }
-
-  @override
-  Future<List<Fortune>> getFortunes() {
-    return _fortunes.find().map(FortuneSerializer.fromMap).toList();
-  }
-
-  @override
-  Future<World> getRandomWorld() {
-    return _worlds
-        .findOne(where.skip(rnd.nextInt(worldTableSize)))
-        .then(WorldSerializer.fromMap);
-  }
-
-  @override
-  Future<World> updateWorld(id, World world) {
-    return _worlds
-        .update(where.eq('id', id), world.toJson())
-        .then(WorldSerializer.fromMap);
-  }
-}

+ 0 - 41
frameworks/Dart/angel/lib/src/query/postgres.dart

@@ -1,41 +0,0 @@
-import 'dart:async';
-import 'package:dart_angel_benchmark/src/models/fortune.dart';
-import 'package:postgres/postgres.dart';
-import '../models/models.dart';
-import 'querier.dart';
-
-class PostgresQuerier implements Querier {
-  final PostgreSQLConnection connection;
-
-  PostgresQuerier(this.connection);
-
-  static Fortune parseFortune(List row) {
-    return Fortune(id: row[0], message: row[1]);
-  }
-
-  static World parseWorld(List row) {
-    return World(id: row[0], randomNumber: row[1]);
-  }
-
-  @override
-  Future<List<Fortune>> getFortunes() {
-    return connection.query('SELECT id, message FROM fortune').then((rows) {
-      return rows.map((parseFortune)).toList();
-    });
-  }
-
-  @override
-  Future<World> getRandomWorld() async {
-    var rows = await connection
-        .query('SELECT id, randomNumber FROM world ORDER BY RANDOM() LIMIT 1');
-    return parseWorld(rows[0]);
-  }
-
-  @override
-  Future<World> updateWorld(id, World world) async {
-    await connection.query(
-        'UPDATE world SET randomNumber = @randomNumber WHERE id = @id',
-        substitutionValues: {'id': id, 'randomNumber': world.randomNumber});
-    return world;
-  }
-}

+ 0 - 10
frameworks/Dart/angel/lib/src/query/querier.dart

@@ -1,10 +0,0 @@
-import 'dart:async';
-import '../models/models.dart';
-
-abstract class Querier {
-  Future<List<Fortune>> getFortunes();
-
-  Future<World> getRandomWorld();
-
-  Future<World> updateWorld(id, World world);
-}

+ 0 - 3
frameworks/Dart/angel/lib/src/query/query.dart

@@ -1,3 +0,0 @@
-export 'mongo.dart';
-export 'postgres.dart';
-export 'querier.dart';

+ 0 - 18
frameworks/Dart/angel/pubspec.yaml

@@ -1,18 +0,0 @@
-name: dart_angel_benchmark
-publish_to: none
-environment:
-  sdk: ">=2.0.0-dev <3.0.0"
-dependencies:
-  angel_configuration: ^2.0.0
-  angel_framework: ^2.0.0-alpha.22
-  angel_model: ^1.0.0
-  angel_serialize: ^2.0.0
-  args: ^1.0.0
-  mongo_dart: ^0.3.4
-  mustache4dart: ^3.0.0-dev.0.0
-  postgres: ^1.0.0
-dev_dependencies:
-  angel_serialize_generator: ^2.0.0
-  build_runner: ^1.0.0
-dependency_overrides:
-  uuid: ^2.0.0-rc.1

+ 0 - 1
frameworks/Dart/angel/views/fortunes.mustache

@@ -1 +0,0 @@
-<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>{{#fortunes}}<tr><td>{{id}}</td><td>{{message}}</td></tr>{{/fortunes}}</table></body></html>

+ 0 - 37
frameworks/Dart/aqueduct/README.md

@@ -1,37 +0,0 @@
-# Aqueduct Framework Benchmarking Test
-
-This test adds [Aqueduct](https://aqueduct.io), a microframework for Dart, to the [benchmarking test suite](../). The test is based on the Dart Benchmarking Test.
-
-## Versions
-
-* [Dart SDK version >=1.7.0](http://www.dartlang.org/)
-* [Dart aqueduct version 2.5.0+1](https://pub.dartlang.org/packages/aqueduct)
-* [Dart Mustache version 1.0.0](https://pub.dartlang.org/packages/mustache)
-
-## Test URLs
-
-### Common
-
-#### JSON Encoding Test
-http://localhost:8080/json
-
-#### Plaintext Test
-http://localhost:8080/plaintext
-
-
-### PostgreSQL
-
-#### Data-Store/Database Mapping Test
-http://localhost:8080/db
-
-#### Variable Query Test
-http://localhost:8080/queries/2
-
-#### Fortunes Test
-http://localhost:8080/fortunes
-
-#### Data-Store/Database Update Test
-http://localhost:8080/updates
-
-#### Variable Update Test
-http://localhost:8080/updates/2

+ 0 - 9
frameworks/Dart/aqueduct/aqueduct.dockerfile

@@ -1,9 +0,0 @@
-FROM google/dart:1.24
-
-COPY ./ ./
-
-RUN pub upgrade
-
-EXPOSE 8080
-
-CMD dart server.dart

+ 0 - 28
frameworks/Dart/aqueduct/benchmark_config.json

@@ -1,28 +0,0 @@
-{
-  "framework": "aqueduct",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "plaintext_url": "/plaintext",
-      "db_url": "/db",
-      "query_url": "/queries/",
-      "update_url": "/updates/",
-      "fortune_url": "/fortunes",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "Postgres",
-      "framework": "aqueduct",
-      "language": "Dart",
-      "flavor": "None",
-      "orm": "Micro",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Aqueduct",
-      "notes": "",
-      "versus": "dart"
-    }
-  }]
-}

+ 0 - 19
frameworks/Dart/aqueduct/config.toml

@@ -1,19 +0,0 @@
-[framework]
-name = "aqueduct"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries/"
-urls.update = "/updates/"
-urls.fortune = "/fortunes"
-approach = "Realistic"
-classification = "Micro"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Micro"
-platform = "None"
-webserver = "None"
-versus = "dart"

+ 0 - 6
frameworks/Dart/aqueduct/config.yaml

@@ -1,6 +0,0 @@
-database:
- username: benchmarkdbuser
- password: benchmarkdbpass
- host: tfb-database
- port: 5432
- databaseName: hello_world

+ 0 - 20
frameworks/Dart/aqueduct/fortunes.mustache

@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Fortunes</title>
-  </head>
-  <body>
-    <table>
-      <tr>
-        <th>id</th>
-        <th>message</th>
-      </tr>
-      {{#fortunes}}
-      <tr>
-        <td>{{id}}</td>
-        <td>{{message}}</td>
-      </tr>
-      {{/fortunes}}
-    </table>
-  </body>
-</html>

+ 0 - 11
frameworks/Dart/aqueduct/pubspec.yaml

@@ -1,11 +0,0 @@
-name: DartAqueductBenchmark
-description: A Benchmark of Dart Aqueduct
-version: 1.0.0
-author: Alexander Haslam <[email protected]>
-
-environment:
-  sdk: '>=1.20.0 <2.0.0'
-
-dependencies:
-  aqueduct: ^2.5.0+1
-  mustache: ^1.0.0

+ 0 - 227
frameworks/Dart/aqueduct/server.dart

@@ -1,227 +0,0 @@
-import 'dart:async';
-import 'dart:io';
-import 'dart:math';
-
-import 'package:aqueduct/aqueduct.dart';
-import 'package:mustache/mustache.dart' as mustache;
-
-export 'dart:async';
-export 'dart:io';
-export 'package:aqueduct/aqueduct.dart';
-
-final _stripped_text = new ContentType("text", "plain");
-final _stripped_json = new ContentType("application", "json");
-
-final _random = new Random();
-
-// World table size
-const int _world_table_size = 10000;
-// Fortune table size used only for generation of data
-const int _FORTUNE_TABLE_SIZE = 100;
-
-const int _min_query_count = 1;
-const int _max_query_count = 500;
-
-Future main() async {
-  try {
-    var app = new Application<DartAqueductBenchmarkSink>();
-    var config = new ApplicationConfiguration()
-      ..port = 8080
-      ..configurationFilePath = "config.yaml";
-
-    app.configuration = config;
-    int optimalInstanceCount =
-        (Platform.numberOfProcessors > 1 ? Platform.numberOfProcessors - 1 : 1);
-    await app.start(
-        numberOfInstances: optimalInstanceCount, consoleLogging: false);
-  } catch (e, st) {
-    await writeError("$e\n $st");
-  }
-}
-
-Future writeError(String error) async {
-  print("$error");
-}
-
-class Fortune extends ManagedObject<_Fortune>
-    implements _Fortune, Comparable<Fortune> {
-  compareTo(Fortune other) => message.compareTo(other.message);
-}
-
-class _Fortune {
-  static String tableName() => "fortune";
-
-  @ManagedColumnAttributes(primaryKey: true)
-  int id;
-
-  String message;
-}
-
-class World extends ManagedObject<_World> implements _World {}
-
-class _World {
-  static String tableName() => "world";
-
-  @ManagedColumnAttributes(primaryKey: true)
-  int id;
-
-  int randomNumber;
-}
-
-/// This type initializes an application.
-///
-/// Override methods in this class to set up routes and initialize resources like
-/// database connections. See http://aqueduct.io/docs/http/request_sink.
-class DartAqueductBenchmarkSink extends RequestSink {
-  mustache.Template fortunesTemplate;
-
-  /// Resource initialization code goes here.
-  ///
-  /// Resources like [AuthServer] and [PostgreSQLPersistentStore] should be instantiated
-  /// in this constructor. Configuration behavior - like [HTTPCodecRepository.add] - should be
-  /// configured in this constructor.
-  ///
-  /// The [appConfig] contains configuration data from `aqueduct serve`, e.g.
-  /// the port the application is running on and the path to a configuration file.
-  DartAqueductBenchmarkSink(ApplicationConfiguration appConfig)
-      : super(appConfig) {
-    // Use logging for debuging only
-//    logger.onRecord.listen(
-//        (rec) => print("$rec ${rec.error ?? ""} ${rec.stackTrace ?? ""}"));
-
-    var options =
-        new DartAqueductBenchmarkConfiguration(appConfig.configurationFilePath);
-    ManagedContext.defaultContext = contextWithConnectionInfo(options.database);
-  }
-
-  /// Final initialization method for this instance.
-  ///
-  /// This method allows any resources that require asynchronous initialization to complete their
-  /// initialization process. This method is invoked after [setupRouter] and prior to this
-  /// instance receiving any requests.
-  @override
-  Future willOpen() async {
-    // Load the Mustache Template
-    final template = await new File('fortunes.mustache').readAsString();
-    fortunesTemplate = new mustache.Template(template);
-  }
-
-  /// All routes must be configured in this method.
-  ///
-  /// This method is invoked after the constructor and before [willOpen].
-  /// All routes must be set up in this method and cannot be added after this method completes.
-  @override
-  void setupRouter(Router router) {
-    router
-        .route("/json")
-        .listen((req) async => new Response.ok({"message": "Hello, World!"})
-          ..contentType = _stripped_json
-          ..headers["date"] = new DateTime.now());
-
-    router
-        .route("/plaintext")
-        .listen((req) async => new Response.ok("Hello, World!")
-          ..contentType = _stripped_text
-          ..headers["date"] = new DateTime.now());
-
-    router.route("/db").listen((req) async {
-      World result = await getRandomWorldObject();
-      return new Response.ok(result)
-        ..contentType = _stripped_json
-        ..headers["date"] = new DateTime.now();
-    });
-
-    router.route("/queries/[:queryCount]").listen((req) async {
-      int queryCount = _min_query_count;
-      if (req.path.variables.containsKey("queryCount")) {
-        queryCount = int
-            .parse(req.path.variables["queryCount"], onError: (_) => queryCount)
-            .clamp(_min_query_count, _max_query_count);
-      }
-      List<Future> resultFutures =
-          new List.generate(queryCount, (_) => getRandomWorldObject());
-      List results = await Future.wait(resultFutures);
-      return new Response.ok(results)
-        ..contentType = _stripped_json
-        ..headers["date"] = new DateTime.now();
-    });
-
-    router.route("/updates/[:queryCount]").listen((req) async {
-      int queryCount = _min_query_count;
-      if (req.path.variables.containsKey("queryCount")) {
-        queryCount = int
-            .parse(req.path.variables["queryCount"], onError: (_) => queryCount)
-            .clamp(_min_query_count, _max_query_count);
-      }
-      List<Future> resultFutures = new List.generate(
-          queryCount,
-          (_) => getRandomWorldObject().then((World world) async {
-                Query query = new Query<World>()
-                  ..where.id = whereEqualTo(world.id)
-                  ..values.randomNumber =
-                      (_random.nextInt(_world_table_size) + 1);
-                return query.updateOne();
-              }));
-      List results = await Future.wait(resultFutures);
-      return new Response.ok(results)
-        ..contentType = _stripped_json
-        ..headers["date"] = new DateTime.now();
-    });
-
-    router.route("/fortunes").listen((req) async {
-      Query query = new Query<Fortune>();
-      List<Fortune> results = await query.fetch();
-      results.add(new Fortune()
-        ..id = 0
-        ..message = "Additional fortune added at request time.");
-      results.sort();
-
-      List resultsMapped = results
-          .map((Fortune fortune) =>
-              {'id': fortune.id, 'message': fortune.message})
-          .toList();
-
-      String renderedTemplate =
-          fortunesTemplate.renderString({'fortunes': resultsMapped});
-      return new Response.ok(renderedTemplate)
-        ..contentType = ContentType.HTML
-        ..headers["date"] = new DateTime.now();
-    });
-  }
-
-  Future<World> getRandomWorldObject() async {
-    int worldId = _random.nextInt(_world_table_size) + 1;
-    Query query = new Query<World>()..where.id = worldId;
-    return query.fetchOne();
-  }
-
-  /*
-   * Helper methods
-   */
-
-  ManagedContext contextWithConnectionInfo(
-      DatabaseConnectionConfiguration connectionInfo) {
-    var dataModel = new ManagedDataModel.fromCurrentMirrorSystem();
-    var psc = new PostgreSQLPersistentStore.fromConnectionInfo(
-        connectionInfo.username,
-        connectionInfo.password,
-        connectionInfo.host,
-        connectionInfo.port,
-        connectionInfo.databaseName);
-
-    return new ManagedContext(dataModel, psc);
-  }
-}
-
-/// An instance of this class reads values from a configuration
-/// file specific to this application.
-///
-/// Configuration files must have key-value for the properties in this class.
-/// For more documentation on configuration files, see https://aqueduct.io/docs/configure/ and
-/// https://pub.dartlang.org/packages/safe_config.
-class DartAqueductBenchmarkConfiguration extends ConfigurationItem {
-  DartAqueductBenchmarkConfiguration(String fileName)
-      : super.fromFile(fileName);
-
-  DatabaseConnectionConfiguration database;
-}

+ 0 - 65
frameworks/Dart/redstone/README.md

@@ -1,65 +0,0 @@
-# Redstone.dart Framework Benchmarking Test
-
-This test adds [Redstone.dart](http://redstonedart.org), a microframework for Dart, to the [benchmarking test suite](../). The test is based on the Dart Benchmarking Test.
-
-## Versions
-
-* [Dart SDK version >=1.7.0](http://www.dartlang.org/)
-* [Dart args version 0.10.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 mongo_dart version 0.1.44](http://pub.dartlang.org/packages/mongo_dart)
-* [Dart postgresql version 0.2.14](http://pub.dartlang.org/packages/postgresql)
-* [Dart redstone version 0.5.18](http://pub.dartlang.org/packages/redstone)
-* [Dart yaml version 2.0.1+1](http://pub.dartlang.org/packages/yaml)
-* [Dart redstone_mapper version 0.1.9](http://pub.dartlang.org/packages/redstone_mapper)
-* [Dart redstone_mapper_mongo version 0.1.1+1](http://pub.dartlang.org/packages/redstone_mapper_mongo)
-* [Dart redstone_mapper_pg version 0.1.1](http://pub.dartlang.org/packages/redstone_mapper_pg)
-
-## Test URLs
-
-### Common
-
-#### JSON Encoding Test
-http://localhost:8080/json
-
-#### Plaintext Test
-http://localhost:8080/plaintext
-
-
-### PostgreSQL
-
-#### Data-Store/Database Mapping Test
-http://localhost:8080/pg/db
-
-#### Variable Query Test
-http://localhost:8080/pg/queries?queries=2
-
-#### Fortunes Test
-http://localhost:8080/pg/fortunes
-
-#### Data-Store/Database Update Test
-http://localhost:8080/pg/updates
-
-#### Variable Update Test
-http://localhost:8080/pg/updates?queries=2
-
-
-### MongoDB
-
-#### Data-Store/Database Mapping Test
-http://localhost:8080/mongo/db
-
-#### Variable Query Test
-http://localhost:8080/mongo/queries?queries=2
-
-#### Fortunes Test
-http://localhost:8080/mongo/fortunes
-
-#### Data-Store/Database Update Test
-http://localhost:8080/mongo/updates
-
-#### Variable Update Test
-http://localhost:8080/mongo/updates?queries=2
-
-

+ 0 - 49
frameworks/Dart/redstone/benchmark_config.json

@@ -1,49 +0,0 @@
-{
-  "framework": "redstone",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "db_url": "/pg/db",
-      "query_url": "/pg/queries?queries=",
-      "fortune_url": "/pg/fortunes",
-      "update_url": "/pg/updates?queries=",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "Postgres",
-      "framework": "redstone",
-      "language": "Dart",
-      "flavor": "None",
-      "orm": "Micro",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "redstone",
-      "notes": "",
-      "versus": "dart"
-    },
-    "mongodb": {
-      "db_url": "/mongo/db",
-      "query_url": "/mongo/queries?queries=",
-      "fortune_url": "/mongo/fortunes",
-      "update_url": "/mongo/updates?queries=",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MongoDB",
-      "framework": "redstone",
-      "language": "Dart",
-      "flavor": "None",
-      "orm": "Micro",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "redstone",
-      "notes": "",
-      "versus": "dart"
-    }
-  }]
-}

+ 0 - 34
frameworks/Dart/redstone/config.toml

@@ -1,34 +0,0 @@
-[framework]
-name = "redstone"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/pg/db"
-urls.query = "/pg/queries?queries="
-urls.update = "/pg/updates?queries="
-urls.fortune = "/pg/fortunes"
-approach = "Realistic"
-classification = "Micro"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Micro"
-platform = "None"
-webserver = "None"
-versus = "dart"
-
-[mongodb]
-urls.db = "/mongo/db"
-urls.query = "/mongo/queries?queries="
-urls.update = "/mongo/updates?queries="
-urls.fortune = "/mongo/fortunes"
-approach = "Realistic"
-classification = "Micro"
-database = "MongoDB"
-database_os = "Linux"
-os = "Linux"
-orm = "Micro"
-platform = "None"
-webserver = "None"
-versus = "dart"

+ 0 - 20
frameworks/Dart/redstone/fortunes.mustache

@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Fortunes</title>
-  </head>
-  <body>
-    <table>
-      <tr>
-        <th>id</th>
-        <th>message</th>
-      </tr>
-      {{#fortunes}}
-      <tr>
-        <td>{{id}}</td>
-        <td>{{message}}</td>
-      </tr>
-      {{/fortunes}}
-    </table>
-  </body>
-</html>

+ 0 - 2
frameworks/Dart/redstone/mongodb.yaml

@@ -1,2 +0,0 @@
-host: tfb-database
-database: hello_world

+ 0 - 5
frameworks/Dart/redstone/postgresql.yaml

@@ -1,5 +0,0 @@
-host: tfb-database
-port: 5432
-user: benchmarkdbuser
-password: benchmarkdbpass
-database: hello_world

+ 0 - 15
frameworks/Dart/redstone/pubspec.yaml

@@ -1,15 +0,0 @@
-name: DartRedstoneBenchmark
-description: A benchmark of Redstone.dart, a server-side microframework for Dart
-environment:
-  sdk: ">=1.7.0 <2.0.0"
-dependencies:
-  crypto: 0.9.0
-  mongo_dart: 0.1.44
-  mustache: 0.1.8
-  postgresql: 0.2.14
-  redstone: 0.5.18
-  redstone_mapper: 0.1.9
-  redstone_mapper_mongo: 0.1.1+1
-  redstone_mapper_pg: 0.1.1
-  system_info: 0.0.16
-  yaml: 2.0.1+1

+ 0 - 14
frameworks/Dart/redstone/redstone-mongodb.dockerfile

@@ -1,14 +0,0 @@
-FROM google/dart:1.24
-
-WORKDIR /redstone
-COPY fortunes.mustache fortunes.mustache
-COPY mongodb.yaml mongodb.yaml
-COPY postgresql.yaml postgresql.yaml
-COPY pubspec.yaml pubspec.yaml
-COPY server.dart server.dart
-
-RUN pub upgrade
-
-EXPOSE 8080
-
-CMD ["dart", "server.dart"]

+ 0 - 14
frameworks/Dart/redstone/redstone.dockerfile

@@ -1,14 +0,0 @@
-FROM google/dart:1.24
-
-WORKDIR /redstone
-COPY fortunes.mustache fortunes.mustache
-COPY mongodb.yaml mongodb.yaml
-COPY postgresql.yaml postgresql.yaml
-COPY pubspec.yaml pubspec.yaml
-COPY server.dart server.dart
-
-RUN pub upgrade
-
-EXPOSE 8080
-
-CMD ["dart", "server.dart"]

+ 0 - 272
frameworks/Dart/redstone/server.dart

@@ -1,272 +0,0 @@
-import "dart:core";
-import "dart:io";
-import "dart:isolate";
-import 'dart:async' show Future;
-import 'dart:math' show Random, max;
-import "package:redstone/server.dart" as app;
-import "package:redstone_mapper/mapper.dart";
-import "package:redstone_mapper/plugin.dart";
-import "package:redstone_mapper_mongo/manager.dart";
-import "package:redstone_mapper_pg/manager.dart";
-import "package:postgresql/postgresql.dart" as pg;
-import "package:di/di.dart";
-import 'package:yaml/yaml.dart' as yaml;
-import 'package:mustache/mustache.dart' as mustache;
-import 'package:system_info/system_info.dart';
-
-final _NUM_PROCESSORS = SysInfo.processors.length;
-
-const _WORLD_TABLE_SIZE = 10000;
-
-final _RANDOM = new Random();
-
-class Fortune implements Comparable<Fortune> {
-  
-  @Field()
-  int id;
-  
-  @Field()
-  String message;
-  
-  Fortune([this.id, this.message]);
-
-  compareTo(Fortune other) => message.compareTo(other.message);
-  
-}
-
-class World {
-  
-  @Field()
-  int id;
-
-  @Field(model: "randomnumber")
-  int randomNumber;
-
-}
-
-class MongoFortune implements Comparable<MongoFortune> {
-  
-  int _id;
-  
-  @Field(model: "_id")
-  int get id => _id;
-  
-  @Field(model: "_id")
-  set id(num value) => _id = value.toInt();
-  
-  @Field()
-  String message;
-  
-  MongoFortune([this._id, this.message]);
-
-  compareTo(MongoFortune other) => message.compareTo(other.message);
-  
-}
-
-class MongoWorld {
-  
-  int _id;
-  int _randomNumber;
-    
-  @Field(model: "_id")
-  int get id => _id;
-  
-  @Field(model: "_id")
-  set id(num value) => _id = value.toInt();
-
-  @Field()
-  int get randomNumber => _randomNumber;
-  
-  @Field()
-  set randomNumber(num value) => _randomNumber = value.toInt();
-
-}
-
-///Handle PostgreSql connections
[email protected](r'/pg/.+')
-pgSqlManager(PostgreSqlManager pgSql) {
-  pgSql.getConnection().then((conn) {
-    app.request.attributes["dbConn"] = conn;
-    app.chain.next(() {
-      pgSql.closeConnection(conn, error: app.chain.error);
-    });
-  });
-}
-
-///Handle MongoDb connections
[email protected](r'/mongo/.+')
-mongoDbManager(MongoDbManager mongoDb) {
-  mongoDb.getConnection().then((conn) {
-    app.request.attributes["dbConn"] = conn;
-    app.chain.next(() {
-      mongoDb.closeConnection(conn, error: app.chain.error);
-    });
-  });
-}
-
-///JSON test
[email protected]("/json")
-getJson() => {"message": "Hello, World!"};
-
-///PlainText test
[email protected]("/plaintext")
-getPlainText() => "Hello, World!";
-
-///PostgreSql tests
[email protected]("/pg")
-@Encode()
-class PgTests {
-  
-  static const worldQuery = 'SELECT id, randomnumber FROM world WHERE id = @id;';
-  static const worldUpdt = 'UPDATE world SET randomnumber = @randomnumber WHERE id = @id;';
-  
-  static const fortuneQuery = 'SELECT id, message FROM fortune;';
-  
-  PostgreSql get pgSql => app.request.attributes["dbConn"];
-  
-  @app.Route("/db")
-  Future<World> queryTest() {
-    var params = { 'id': _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1 };
-    return pgSql.query(worldQuery, World, params).then((list) => list[0]);
-  }
-
-  @app.Route("/queries")
-  Future<List<World>> queriesTest() {
-    var queries = _parseQueriesParam(app.request.queryParams.queries);
-    return Future.wait(new List.generate(queries, (_) => queryTest()));
-  } 
-  
-  @app.Route("/updates")
-  Future<List<World>> updateTest() {
-    var queries = _parseQueriesParam(app.request.queryParams.queries);
-    return Future.wait(new List.generate(queries, (_) => queryTest().then((world) {
-      world.randomNumber = _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1;
-      return pgSql.execute(worldUpdt, world).then((_) => world);
-    })));
-  }
-  
-  @app.Route("/fortunes", responseType: "text/html;charset=utf-8")
-  Future<String> fortunesTest(@app.Inject() mustache.Template template) {
-    return pgSql.query(fortuneQuery, Fortune).then((values) {
-      values
-          ..add(new Fortune(0, 'Additional fortune added at request time.'))
-          ..sort();
-      
-      return template.renderString({
-        "fortunes": encode(values)
-      });
-    });
-  }
-  
-}
-
-///MongoDb tests
[email protected]("/mongo")
-@Encode()
-class MongoTests {
-  
-  static const worldCollection = "world";
-  static const fortuneCollection = "fortune";
-  
-  MongoDb get mongoDb => app.request.attributes["dbConn"];
-  
-  @app.Route("/db")
-  Future<MongoWorld> queryTest() {
-    return mongoDb.findOne(worldCollection, MongoWorld, {
-      "_id": _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1
-    });
-  }
-  
-  @app.Route("/queries")
-  Future<List<MongoWorld>> queriesTest() {
-    var queries = _parseQueriesParam(app.request.queryParams.queries);
-    return Future.wait(new List.generate(queries, (_) => queryTest()));
-  }
-  
-  @app.Route("/updates")
-  Future<List<MongoWorld>> updateTest() {
-    var queries = _parseQueriesParam(app.request.queryParams.queries);
-    return Future.wait(new List.generate(queries, (_) => queryTest().then((world) {
-      world.randomNumber = _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1;
-      return mongoDb.update(worldCollection, { "_id": world.id }, world)
-          .then((_) => world);
-    })));
-  }
-  
-  @app.Route("/fortunes", responseType: "text/html;charset=utf-8")
-  Future<String> fortunesTest(@app.Inject() mustache.Template template) {
-    return mongoDb.find(fortuneCollection, MongoFortune).then((values) {
-      values
-          ..add(new MongoFortune(0, 'Additional fortune added at request time.'))
-          ..sort();
-      
-      return template.renderString({
-        "fortunes": encode(values)
-      });
-    });
-  }
-  
-}
-
-main(List<String> args) {
-  ReceivePort errorPort = new ReceivePort();
-  errorPort.listen((e) => print(e));
-  for (int i = 0; i < _NUM_PROCESSORS; i++) {
-    Isolate.spawn(
-        startInIsolate,
-        [],
-        onError: errorPort.sendPort);
-  }
-}
-
-startInIsolate(List args) {
-  _startServer();
-}
-
-_startServer() {
-  var dbConnections = max(1, (256 / _NUM_PROCESSORS).floor());
-
-  var mongoDbManager = new MongoDbManager(
-      "mongodb://tfb-database/hello_world",
-      poolSize: dbConnections);
-
-  var pgSqlManager = new PostgreSqlManager(
-      "postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world",
-      min: dbConnections,
-      max: dbConnections);
-
-  mustache.Template fortunesTemplate;
-  
-  Future.wait([
-
-    HttpServer.bind("0.0.0.0", 8080, shared: true),
-
-    new File('fortunes.mustache').readAsString().then((template) {
-      fortunesTemplate = mustache.parse(template);
-    })
-
-  ]).then((List waitResults) {
-    var server = waitResults[0];
-
-    //app.setupConsoleLog();
-    
-    //install module for dependency injection
-    app.addModule(new Module()
-                      ..bind(MongoDbManager, toValue: mongoDbManager)
-                      ..bind(PostgreSqlManager, toValue: pgSqlManager)
-                      ..bind(mustache.Template, toValue: fortunesTemplate));
-    
-    //initialize mapper plugin
-    app.addPlugin(getMapperPlugin());
-    
-    //start the server
-    app.serveRequests(server);
-    
-  });
-
-}
-
-_parseQueriesParam(param) {
-  return param == null || param.isEmpty ? 1 : 
-    int.parse(param, radix: 10, onError: (_) => 1).clamp(1, 500);
-}