diff --git a/frameworks/CSharp/aspnetcore-corert/benchmark_config.json b/frameworks/CSharp/aspnetcore-corert/benchmark_config.json index d40f6754e07..a11a6220f07 100644 --- a/frameworks/CSharp/aspnetcore-corert/benchmark_config.json +++ b/frameworks/CSharp/aspnetcore-corert/benchmark_config.json @@ -16,7 +16,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core", + "display_name": "ASP.NET Core [Platform, CoreRT]", "notes": "", "versus": "aspcore" } diff --git a/frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-my.dockerfile b/frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-my.dockerfile deleted file mode 100644 index ac9cfa2c615..00000000000 --- a/frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-my.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build -WORKDIR /app -COPY Benchmarks . -RUN dotnet publish -c Release -o out - -FROM mcr.microsoft.com/dotnet/runtime-deps:5.0 AS runtime -ENV ASPNETCORE_URLS http://+:8080 -WORKDIR /app -COPY --from=build /app/out ./ -COPY Benchmarks/appsettings.mysql.json ./appsettings.json - -EXPOSE 8080 - -ENTRYPOINT ["./Benchmarks", "scenarios=MvcDbSingleQueryRaw,MvcDbMultiQueryRaw,MvcDbMultiUpdateRaw,MvcDbFortunesRaw"] \ No newline at end of file diff --git a/frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-my.dockerfile b/frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-my.dockerfile deleted file mode 100644 index 4ff4bcab899..00000000000 --- a/frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-my.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build -WORKDIR /app -COPY Benchmarks . -RUN dotnet publish -c Release -o out - -FROM mcr.microsoft.com/dotnet/runtime-deps:5.0 AS runtime -ENV ASPNETCORE_URLS http://+:8080 -WORKDIR /app -COPY --from=build /app/out ./ -COPY Benchmarks/appsettings.mysql.json ./appsettings.json - -EXPOSE 8080 - -ENTRYPOINT ["./Benchmarks", "scenarios=DbSingleQueryRaw,DbMultiQueryRaw,DbMultiUpdateRaw,DbFortunesRaw"] \ No newline at end of file diff --git a/frameworks/CSharp/aspnetcore-mono/benchmark_config.json b/frameworks/CSharp/aspnetcore-mono/benchmark_config.json index 734d119f444..e52c7d74b55 100644 --- a/frameworks/CSharp/aspnetcore-mono/benchmark_config.json +++ b/frameworks/CSharp/aspnetcore-mono/benchmark_config.json @@ -16,7 +16,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core on Mono", + "display_name": "ASP.NET Core [Platform, Mono]", "notes": "", "versus": "aspcore" }, @@ -38,7 +38,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core on Mono", + "display_name": "ASP.NET Core [Platform, Mono, Pg]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -57,7 +57,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core on Mono, Middleware", + "display_name": "ASP.NET Core [Middleware, Mono]", "notes": "", "versus": "aspcore-mono" }, @@ -78,31 +78,10 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core on Mono, Middleware", + "display_name": "ASP.NET Core [Middleware, Mono, Pg]", "notes": "", "versus": "aspcore-mono-pg" }, - "mw-my": { - "db_url": "/db/raw", - "query_url": "/queries/raw?queries=", - "update_url": "/updates/raw?queries=", - "fortune_url": "/fortunes/raw", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "MySQL", - "framework": "ASP.NET Core", - "language": "C#", - "orm": "Raw", - "platform": ".NET", - "flavor": "Mono", - "webserver": "Kestrel", - "os": "Linux", - "database_os": "Linux", - "display_name": "ASP.NET Core on Mono, Middleware", - "notes": "", - "versus": "aspcore-mono-my" - }, "mvc": { "plaintext_url": "/mvc/plaintext", "json_url": "/mvc/json", @@ -118,7 +97,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core on Mono, MVC", + "display_name": "ASP.NET Core [MVC, Mono]", "notes": "", "versus": "aspcore-mono" }, @@ -139,30 +118,9 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core on Mono, MVC", + "display_name": "ASP.NET Core [MVC, Mono, Pg]", "notes": "", "versus": "aspcore-mono-pg" - }, - "mvc-my": { - "db_url": "/mvc/db/raw", - "query_url": "/mvc/queries/raw?queries=", - "update_url": "/mvc/updates/raw?queries=", - "fortune_url": "/mvc/fortunes/raw", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "MySQL", - "framework": "ASP.NET Core", - "language": "C#", - "orm": "Raw", - "platform": ".NET", - "flavor": "Mono", - "webserver": "Kestrel", - "os": "Linux", - "database_os": "Linux", - "display_name": "ASP.NET Core on Mono, MVC", - "notes": "", - "versus": "aspcore-mono-my" } }] } \ No newline at end of file diff --git a/frameworks/CSharp/aspnetcore/benchmark_config.json b/frameworks/CSharp/aspnetcore/benchmark_config.json index c024cd665eb..d7dcaff7afd 100644 --- a/frameworks/CSharp/aspnetcore/benchmark_config.json +++ b/frameworks/CSharp/aspnetcore/benchmark_config.json @@ -16,7 +16,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core", + "display_name": "ASP.NET Core [Platform]", "notes": "", "versus": "aspcore" }, @@ -37,7 +37,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, ADO.NET", + "display_name": "ASP.NET Core [Platform, Pg]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -55,7 +55,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, ADO.NET", + "display_name": "ASP.NET Core [Platform,Pg]", "notes": "", "versus": "aspcore-ado-pg-up" }, @@ -73,7 +73,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware", + "display_name": "ASP.NET Core [Middleware]", "notes": "", "versus": "aspcore" }, @@ -91,7 +91,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, Json", + "display_name": "ASP.NET Core [Middleware]", "notes": "", "versus": "aspcore" }, @@ -111,7 +111,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, ADO.NET", + "display_name": "ASP.NET Core [Middleware, Pg]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -129,7 +129,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, ADO.NET", + "display_name": "ASP.NET Core [Middleware, Pg]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -149,7 +149,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, Entity Framework Core", + "display_name": "ASP.NET Core [Middleware, Pg, EF]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -167,7 +167,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, Entity Framework Core", + "display_name": "ASP.NET Core [Middleware, Pg, EF]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -187,7 +187,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, Dapper", + "display_name": "ASP.NET Core {Middleware, Pg, Dapper]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -205,7 +205,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, Dapper", + "display_name": "ASP.NET Core [Middleware, Pg, Dapper]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -226,7 +226,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, ADO.NET", + "display_name": "ASP.NET Core [Middleware, My]", "notes": "", "versus": "aspcore-ado-my" }, @@ -247,7 +247,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, Middleware, Dapper", + "display_name": "ASP.NET Core [Middleware, My, Dapper]", "notes": "", "versus": "aspcore-ado-my" }, @@ -286,7 +286,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, ADO.NET", + "display_name": "ASP.NET Core [MVC, Pg]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -304,7 +304,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, ADO.NET", + "display_name": "ASP.NET Core [MVC, Pg]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -324,7 +324,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, Entity Framework Core", + "display_name": "ASP.NET Core [MVC, Pg, EF]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -342,7 +342,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, Entity Framework Core", + "display_name": "ASP.NET Core [MVC, Pg, EF]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -362,7 +362,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, Dapper", + "display_name": "ASP.NET Core [MVC, Pg, Dapper]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -380,7 +380,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, Dapper", + "display_name": "ASP.NET Core [MVC, Pg, Dapper]", "notes": "", "versus": "aspcore-ado-pg" }, @@ -401,7 +401,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, Raw", + "display_name": "ASP.NET Core [MVC, My]", "notes": "", "versus": "aspcore-ado-my" }, @@ -422,7 +422,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core, MVC, Dapper", + "display_name": "ASP.NET Core [MVC, My, Dapper]", "notes": "", "versus": "aspcore-ado-my" } diff --git a/frameworks/CSharp/ben/benchmark_config.json b/frameworks/CSharp/ben/benchmark_config.json index 8081f86b5a1..b2678519679 100644 --- a/frameworks/CSharp/ben/benchmark_config.json +++ b/frameworks/CSharp/ben/benchmark_config.json @@ -18,7 +18,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "Ben", + "display_name": "Ben [Kestrel]", "notes": "", "versus": "aspcore" } diff --git a/frameworks/CSharp/nancy/benchmark_config.json b/frameworks/CSharp/nancy/benchmark_config.json index 0d6df139beb..60286ac81ae 100644 --- a/frameworks/CSharp/nancy/benchmark_config.json +++ b/frameworks/CSharp/nancy/benchmark_config.json @@ -18,7 +18,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "Nancy on ASP.NET Core on Mono", + "display_name": "Nancy [ASP.NET Core, Mono, My]", "notes": "", "versus": "aspcore-mono" }, @@ -39,7 +39,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "Nancy on ASP.NET Core on .NET Core", + "display_name": "Nancy [ASP.NET Core, My]", "notes": "", "versus": "aspcore" } diff --git a/frameworks/Dart/angel/.gitignore b/frameworks/Dart/angel/.gitignore deleted file mode 100644 index b84388bd30b..00000000000 --- a/frameworks/Dart/angel/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -!bin/ -.dart_tool -.packages -*.reflectable.dart -*.g.part -*.g.dart diff --git a/frameworks/Dart/angel/README.md b/frameworks/Dart/angel/README.md deleted file mode 100755 index d148041e909..00000000000 --- a/frameworks/Dart/angel/README.md +++ /dev/null @@ -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 diff --git a/frameworks/Dart/angel/angel-postgres.dockerfile b/frameworks/Dart/angel/angel-postgres.dockerfile deleted file mode 100644 index 1aa37ff8472..00000000000 --- a/frameworks/Dart/angel/angel-postgres.dockerfile +++ /dev/null @@ -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 diff --git a/frameworks/Dart/angel/angel.dockerfile b/frameworks/Dart/angel/angel.dockerfile deleted file mode 100644 index cde0b5929e0..00000000000 --- a/frameworks/Dart/angel/angel.dockerfile +++ /dev/null @@ -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 diff --git a/frameworks/Dart/angel/benchmark_config.json b/frameworks/Dart/angel/benchmark_config.json deleted file mode 100755 index d18816036bc..00000000000 --- a/frameworks/Dart/angel/benchmark_config.json +++ /dev/null @@ -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"] - } - } - ] -} diff --git a/frameworks/Dart/angel/bin/main.dart b/frameworks/Dart/angel/bin/main.dart deleted file mode 100644 index d56668b8e6e..00000000000 --- a/frameworks/Dart/angel/bin/main.dart +++ /dev/null @@ -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 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); -} diff --git a/frameworks/Dart/angel/config.toml b/frameworks/Dart/angel/config.toml deleted file mode 100644 index a14dc2fba7d..00000000000 --- a/frameworks/Dart/angel/config.toml +++ /dev/null @@ -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" diff --git a/frameworks/Dart/angel/config/default.yaml b/frameworks/Dart/angel/config/default.yaml deleted file mode 100644 index 4aeb7fff1db..00000000000 --- a/frameworks/Dart/angel/config/default.yaml +++ /dev/null @@ -1,6 +0,0 @@ -postgres: - username: benchmarkdbuser - password: benchmarkdbpass - host: tfb-database - port: 5432 - databaseName: hello_world \ No newline at end of file diff --git a/frameworks/Dart/angel/config/production.yaml b/frameworks/Dart/angel/config/production.yaml deleted file mode 100644 index ada804d23c2..00000000000 --- a/frameworks/Dart/angel/config/production.yaml +++ /dev/null @@ -1 +0,0 @@ -mongo_db: "mongodb://tfb-database/hello_world" \ No newline at end of file diff --git a/frameworks/Dart/angel/lib/dart_angel_benchmark.dart b/frameworks/Dart/angel/lib/dart_angel_benchmark.dart deleted file mode 100644 index e3c91518942..00000000000 --- a/frameworks/Dart/angel/lib/dart_angel_benchmark.dart +++ /dev/null @@ -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(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(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(); - res.serialize(await querier.getRandomWorld()); - }); - - // DB queries - app.get('/queries', (req, res) async { - // Get the querier and query count. - var querier = req.container.make(); - var queryCount = - int.tryParse(req.uri.queryParameters['queryCount'].toString()) ?? - minQueryCount; - queryCount = queryCount.clamp(minQueryCount, maxQueryCount); - - // Fetch the objects. - var worlds = await Future.wait( - 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(); - var queryCount = - int.tryParse(req.uri.queryParameters['queryCount'].toString()) ?? - minQueryCount; - queryCount = queryCount.clamp(minQueryCount, maxQueryCount); - - // Fetch the objects. - var worlds = - await Future.wait(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(); - 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()))}); - }); - }; -} diff --git a/frameworks/Dart/angel/lib/src/models/fortune.dart b/frameworks/Dart/angel/lib/src/models/fortune.dart deleted file mode 100644 index 226bb9f87be..00000000000 --- a/frameworks/Dart/angel/lib/src/models/fortune.dart +++ /dev/null @@ -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; -} diff --git a/frameworks/Dart/angel/lib/src/models/models.dart b/frameworks/Dart/angel/lib/src/models/models.dart deleted file mode 100644 index 445c927fa46..00000000000 --- a/frameworks/Dart/angel/lib/src/models/models.dart +++ /dev/null @@ -1,2 +0,0 @@ -export 'fortune.dart'; -export 'world.dart'; diff --git a/frameworks/Dart/angel/lib/src/models/world.dart b/frameworks/Dart/angel/lib/src/models/world.dart deleted file mode 100644 index 7c9e345a07b..00000000000 --- a/frameworks/Dart/angel/lib/src/models/world.dart +++ /dev/null @@ -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; -} diff --git a/frameworks/Dart/angel/lib/src/query/mongo.dart b/frameworks/Dart/angel/lib/src/query/mongo.dart deleted file mode 100644 index 5734c8581da..00000000000 --- a/frameworks/Dart/angel/lib/src/query/mongo.dart +++ /dev/null @@ -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> getFortunes() { - return _fortunes.find().map(FortuneSerializer.fromMap).toList(); - } - - @override - Future getRandomWorld() { - return _worlds - .findOne(where.skip(rnd.nextInt(worldTableSize))) - .then(WorldSerializer.fromMap); - } - - @override - Future updateWorld(id, World world) { - return _worlds - .update(where.eq('id', id), world.toJson()) - .then(WorldSerializer.fromMap); - } -} diff --git a/frameworks/Dart/angel/lib/src/query/postgres.dart b/frameworks/Dart/angel/lib/src/query/postgres.dart deleted file mode 100644 index 4881c6a6913..00000000000 --- a/frameworks/Dart/angel/lib/src/query/postgres.dart +++ /dev/null @@ -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> getFortunes() { - return connection.query('SELECT id, message FROM fortune').then((rows) { - return rows.map((parseFortune)).toList(); - }); - } - - @override - Future getRandomWorld() async { - var rows = await connection - .query('SELECT id, randomNumber FROM world ORDER BY RANDOM() LIMIT 1'); - return parseWorld(rows[0]); - } - - @override - Future updateWorld(id, World world) async { - await connection.query( - 'UPDATE world SET randomNumber = @randomNumber WHERE id = @id', - substitutionValues: {'id': id, 'randomNumber': world.randomNumber}); - return world; - } -} diff --git a/frameworks/Dart/angel/lib/src/query/querier.dart b/frameworks/Dart/angel/lib/src/query/querier.dart deleted file mode 100644 index 9b884cfd8fb..00000000000 --- a/frameworks/Dart/angel/lib/src/query/querier.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'dart:async'; -import '../models/models.dart'; - -abstract class Querier { - Future> getFortunes(); - - Future getRandomWorld(); - - Future updateWorld(id, World world); -} diff --git a/frameworks/Dart/angel/lib/src/query/query.dart b/frameworks/Dart/angel/lib/src/query/query.dart deleted file mode 100644 index bb3c901738e..00000000000 --- a/frameworks/Dart/angel/lib/src/query/query.dart +++ /dev/null @@ -1,3 +0,0 @@ -export 'mongo.dart'; -export 'postgres.dart'; -export 'querier.dart'; diff --git a/frameworks/Dart/angel/pubspec.yaml b/frameworks/Dart/angel/pubspec.yaml deleted file mode 100644 index 2cc75c88001..00000000000 --- a/frameworks/Dart/angel/pubspec.yaml +++ /dev/null @@ -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 diff --git a/frameworks/Dart/angel/views/fortunes.mustache b/frameworks/Dart/angel/views/fortunes.mustache deleted file mode 100644 index d85a356925b..00000000000 --- a/frameworks/Dart/angel/views/fortunes.mustache +++ /dev/null @@ -1 +0,0 @@ -Fortunes{{#fortunes}}{{/fortunes}}
idmessage
{{id}}{{message}}
\ No newline at end of file diff --git a/frameworks/Dart/aqueduct/README.md b/frameworks/Dart/aqueduct/README.md deleted file mode 100644 index 3ced19c82be..00000000000 --- a/frameworks/Dart/aqueduct/README.md +++ /dev/null @@ -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 diff --git a/frameworks/Dart/aqueduct/aqueduct.dockerfile b/frameworks/Dart/aqueduct/aqueduct.dockerfile deleted file mode 100644 index 36fa1625861..00000000000 --- a/frameworks/Dart/aqueduct/aqueduct.dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM google/dart:1.24 - -COPY ./ ./ - -RUN pub upgrade - -EXPOSE 8080 - -CMD dart server.dart diff --git a/frameworks/Dart/aqueduct/benchmark_config.json b/frameworks/Dart/aqueduct/benchmark_config.json deleted file mode 100644 index df700883ac9..00000000000 --- a/frameworks/Dart/aqueduct/benchmark_config.json +++ /dev/null @@ -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" - } - }] -} diff --git a/frameworks/Dart/aqueduct/config.toml b/frameworks/Dart/aqueduct/config.toml deleted file mode 100644 index d3c7937e68f..00000000000 --- a/frameworks/Dart/aqueduct/config.toml +++ /dev/null @@ -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" diff --git a/frameworks/Dart/aqueduct/config.yaml b/frameworks/Dart/aqueduct/config.yaml deleted file mode 100644 index d40239ce35c..00000000000 --- a/frameworks/Dart/aqueduct/config.yaml +++ /dev/null @@ -1,6 +0,0 @@ -database: - username: benchmarkdbuser - password: benchmarkdbpass - host: tfb-database - port: 5432 - databaseName: hello_world \ No newline at end of file diff --git a/frameworks/Dart/aqueduct/fortunes.mustache b/frameworks/Dart/aqueduct/fortunes.mustache deleted file mode 100644 index 77ea1a96cf5..00000000000 --- a/frameworks/Dart/aqueduct/fortunes.mustache +++ /dev/null @@ -1,20 +0,0 @@ - - - - Fortunes - - - - - - - - {{#fortunes}} - - - - - {{/fortunes}} -
idmessage
{{id}}{{message}}
- - diff --git a/frameworks/Dart/aqueduct/pubspec.yaml b/frameworks/Dart/aqueduct/pubspec.yaml deleted file mode 100644 index dedde56a8ee..00000000000 --- a/frameworks/Dart/aqueduct/pubspec.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: DartAqueductBenchmark -description: A Benchmark of Dart Aqueduct -version: 1.0.0 -author: Alexander Haslam - -environment: - sdk: '>=1.20.0 <2.0.0' - -dependencies: - aqueduct: ^2.5.0+1 - mustache: ^1.0.0 diff --git a/frameworks/Dart/aqueduct/server.dart b/frameworks/Dart/aqueduct/server.dart deleted file mode 100644 index 40f0f1fb5eb..00000000000 --- a/frameworks/Dart/aqueduct/server.dart +++ /dev/null @@ -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(); - 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 { - 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 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 resultFutures = new List.generate( - queryCount, - (_) => getRandomWorldObject().then((World world) async { - Query query = new Query() - ..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(); - List 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 getRandomWorldObject() async { - int worldId = _random.nextInt(_world_table_size) + 1; - Query query = new Query()..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; -} diff --git a/frameworks/Dart/redstone/README.md b/frameworks/Dart/redstone/README.md deleted file mode 100644 index c07a2e660ae..00000000000 --- a/frameworks/Dart/redstone/README.md +++ /dev/null @@ -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 - - diff --git a/frameworks/Dart/redstone/benchmark_config.json b/frameworks/Dart/redstone/benchmark_config.json deleted file mode 100644 index cff39cd1f43..00000000000 --- a/frameworks/Dart/redstone/benchmark_config.json +++ /dev/null @@ -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" - } - }] -} diff --git a/frameworks/Dart/redstone/config.toml b/frameworks/Dart/redstone/config.toml deleted file mode 100644 index f314442f4e3..00000000000 --- a/frameworks/Dart/redstone/config.toml +++ /dev/null @@ -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" diff --git a/frameworks/Dart/redstone/fortunes.mustache b/frameworks/Dart/redstone/fortunes.mustache deleted file mode 100644 index 77ea1a96cf5..00000000000 --- a/frameworks/Dart/redstone/fortunes.mustache +++ /dev/null @@ -1,20 +0,0 @@ - - - - Fortunes - - - - - - - - {{#fortunes}} - - - - - {{/fortunes}} -
idmessage
{{id}}{{message}}
- - diff --git a/frameworks/Dart/redstone/mongodb.yaml b/frameworks/Dart/redstone/mongodb.yaml deleted file mode 100644 index 3fc0ff375d7..00000000000 --- a/frameworks/Dart/redstone/mongodb.yaml +++ /dev/null @@ -1,2 +0,0 @@ -host: tfb-database -database: hello_world diff --git a/frameworks/Dart/redstone/postgresql.yaml b/frameworks/Dart/redstone/postgresql.yaml deleted file mode 100644 index b57e64ef9be..00000000000 --- a/frameworks/Dart/redstone/postgresql.yaml +++ /dev/null @@ -1,5 +0,0 @@ -host: tfb-database -port: 5432 -user: benchmarkdbuser -password: benchmarkdbpass -database: hello_world diff --git a/frameworks/Dart/redstone/pubspec.yaml b/frameworks/Dart/redstone/pubspec.yaml deleted file mode 100644 index 342a5b40a7a..00000000000 --- a/frameworks/Dart/redstone/pubspec.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/frameworks/Dart/redstone/redstone-mongodb.dockerfile b/frameworks/Dart/redstone/redstone-mongodb.dockerfile deleted file mode 100644 index a586c249289..00000000000 --- a/frameworks/Dart/redstone/redstone-mongodb.dockerfile +++ /dev/null @@ -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"] diff --git a/frameworks/Dart/redstone/redstone.dockerfile b/frameworks/Dart/redstone/redstone.dockerfile deleted file mode 100644 index a586c249289..00000000000 --- a/frameworks/Dart/redstone/redstone.dockerfile +++ /dev/null @@ -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"] diff --git a/frameworks/Dart/redstone/server.dart b/frameworks/Dart/redstone/server.dart deleted file mode 100644 index 265320d75d7..00000000000 --- a/frameworks/Dart/redstone/server.dart +++ /dev/null @@ -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 { - - @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 { - - 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 -@app.Interceptor(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 -@app.Interceptor(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 -@app.Route("/json") -getJson() => {"message": "Hello, World!"}; - -///PlainText test -@app.Route("/plaintext") -getPlainText() => "Hello, World!"; - -///PostgreSql tests -@app.Group("/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 queryTest() { - var params = { 'id': _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1 }; - return pgSql.query(worldQuery, World, params).then((list) => list[0]); - } - - @app.Route("/queries") - Future> queriesTest() { - var queries = _parseQueriesParam(app.request.queryParams.queries); - return Future.wait(new List.generate(queries, (_) => queryTest())); - } - - @app.Route("/updates") - Future> 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 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 -@app.Group("/mongo") -@Encode() -class MongoTests { - - static const worldCollection = "world"; - static const fortuneCollection = "fortune"; - - MongoDb get mongoDb => app.request.attributes["dbConn"]; - - @app.Route("/db") - Future queryTest() { - return mongoDb.findOne(worldCollection, MongoWorld, { - "_id": _RANDOM.nextInt(_WORLD_TABLE_SIZE) + 1 - }); - } - - @app.Route("/queries") - Future> queriesTest() { - var queries = _parseQueriesParam(app.request.queryParams.queries); - return Future.wait(new List.generate(queries, (_) => queryTest())); - } - - @app.Route("/updates") - Future> 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 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 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); -} diff --git a/frameworks/Go/go-std/README.md b/frameworks/Go/go-std/README.md index 22edea4b7c4..f8def5f809f 100644 --- a/frameworks/Go/go-std/README.md +++ b/frameworks/Go/go-std/README.md @@ -11,4 +11,4 @@ This is the go portion of a [benchmarking test suite](https://www.techempower.co http://localhost:8080/queries?queries=[1-500] http://localhost:8080/update?queries=[1-500] http://localhost:8080/plaintext - http://localhost:8080/fortune + http://localhost:8080/fortunes diff --git a/frameworks/Go/go-std/benchmark_config.json b/frameworks/Go/go-std/benchmark_config.json index 881cb9c7c16..ae371ee0ad4 100644 --- a/frameworks/Go/go-std/benchmark_config.json +++ b/frameworks/Go/go-std/benchmark_config.json @@ -23,7 +23,7 @@ "pgx": { "db_url": "/db", "query_url": "/queries?queries=", - "fortune_url": "/fortune", + "fortune_url": "/fortunes", "update_url": "/update?queries=", "port": 8080, "approach": "Realistic", @@ -85,7 +85,7 @@ "plaintext_url": "/plaintext", "db_url": "/db", "query_url": "/queries?queries=", - "fortune_url": "/fortune", + "fortune_url": "/fortunes", "update_url": "/update?queries=", "port": 8080, "approach": "Realistic", @@ -145,7 +145,7 @@ "my": { "db_url": "/db", "query_url": "/queries?queries=", - "fortune_url": "/fortune", + "fortune_url": "/fortunes", "update_url": "/update?queries=", "port": 8080, "approach": "Realistic", @@ -166,7 +166,7 @@ "my-prefork": { "db_url": "/db", "query_url": "/queries?queries=", - "fortune_url": "/fortune", + "fortune_url": "/fortunes", "update_url": "/update?queries=", "port": 8080, "approach": "Realistic", @@ -187,7 +187,7 @@ "mgo": { "db_url": "/db", "query_url": "/queries?queries=", - "fortune_url": "/fortune", + "fortune_url": "/fortunes", "update_url": "/update?queries=", "port": 8080, "approach": "Realistic", @@ -208,7 +208,7 @@ "mgo-prefork": { "db_url": "/db", "query_url": "/queries?queries=", - "fortune_url": "/fortune", + "fortune_url": "/fortunes", "update_url": "/update?queries=", "port": 8080, "approach": "Realistic", diff --git a/frameworks/Go/go-std/src/main.go b/frameworks/Go/go-std/src/main.go index b9316734a88..2f7bd835cd4 100644 --- a/frameworks/Go/go-std/src/main.go +++ b/frameworks/Go/go-std/src/main.go @@ -63,7 +63,7 @@ func main() { if db != nil { defer db.Close() // http.HandleFunc("/fortune", handlers.FortuneHandler(db)) - http.HandleFunc("/fortune", handlers.FortuneHandlerPool(db)) + http.HandleFunc("/fortunes", handlers.FortuneHandlerPool(db)) // http.HandleFunc("/fortune-quick", handlers.FortuneQuickHandler(db)) http.HandleFunc("/fortune-quick", handlers.FortuneQuickHandlerPool(db)) if *easyjson { diff --git a/frameworks/Java/martian/martian.dockerfile b/frameworks/Java/martian/martian.dockerfile index 77a70975ddf..014401ed748 100644 --- a/frameworks/Java/martian/martian.dockerfile +++ b/frameworks/Java/martian/martian.dockerfile @@ -11,4 +11,4 @@ COPY --from=maven /martian/target/lib lib EXPOSE 8080 -CMD ["java", "-jar", "martian.jar", "--illegal-access=deny", "--add-opens","java.base/java.lang=ALL-UNNAMED"] \ No newline at end of file +CMD ["java", "-jar", "martian.jar"] \ No newline at end of file diff --git a/frameworks/Java/martian/pom.xml b/frameworks/Java/martian/pom.xml index bbfd4288289..e26a84d4acf 100644 --- a/frameworks/Java/martian/pom.xml +++ b/frameworks/Java/martian/pom.xml @@ -18,7 +18,7 @@ com.github.yuyenews mars-starter - 3.2.15 + 3.3.3 diff --git a/frameworks/Java/martian/src/main/java/com/text/config/TestConfig.java b/frameworks/Java/martian/src/main/java/com/text/config/TestConfig.java index da855b8cee2..07a669aa521 100644 --- a/frameworks/Java/martian/src/main/java/com/text/config/TestConfig.java +++ b/frameworks/Java/martian/src/main/java/com/text/config/TestConfig.java @@ -10,10 +10,12 @@ public int port() { return 8080; } + + @Override public ThreadPoolConfig threadPoolConfig() { ThreadPoolConfig threadPoolConfig = new ThreadPoolConfig(); - threadPoolConfig.setCorePoolSize(2); + threadPoolConfig.setCorePoolSize(200); threadPoolConfig.setMaxPoolSize(10000000); threadPoolConfig.setKeepAliveTime(20); threadPoolConfig.setBackLog(2000); diff --git a/frameworks/Java/martian/src/main/java/com/text/service/TestService.java b/frameworks/Java/martian/src/main/java/com/text/service/TestService.java index 19483de9e10..20ab9f2d428 100644 --- a/frameworks/Java/martian/src/main/java/com/text/service/TestService.java +++ b/frameworks/Java/martian/src/main/java/com/text/service/TestService.java @@ -1,15 +1,14 @@ package com.text.service; +import com.mars.aio.constant.HttpConstant; +import com.mars.aio.server.impl.MarsHttpExchange; import com.mars.common.annotation.bean.MarsBean; -import com.mars.iserver.constant.HttpConstant; -import com.mars.iserver.server.impl.MarsHttpExchange; import com.mars.server.server.request.HttpMarsResponse; import com.text.api.vo.MessageVO; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import java.util.TimeZone; @MarsBean public class TestService { diff --git a/frameworks/Java/redkale/benchmark_config.json b/frameworks/Java/redkale/benchmark_config.json index 3fb2f8753c1..3268f50ddbf 100644 --- a/frameworks/Java/redkale/benchmark_config.json +++ b/frameworks/Java/redkale/benchmark_config.json @@ -39,11 +39,8 @@ "notes": "", "versus": "Redkale" }, - "postgres": { + "db": { "db_url": "/db", - "fortune_url": "/fortunes", - "query_url": "/queries?q=", - "update_url": "/updates?q=", "port": 8080, "approach": "Realistic", "classification": "Fullstack", @@ -60,9 +57,8 @@ "notes": "", "versus": "Redkale" }, - "jdk16": { - "plaintext_url": "/plaintext", - "json_url": "/json", + "query": { + "query_url": "/queries?q=", "port": 8080, "approach": "Realistic", "classification": "Fullstack", @@ -75,13 +71,12 @@ "webserver": "Redkale", "os": "Linux", "database_os": "Linux", - "display_name": "redkale-io", + "display_name": "redkale", "notes": "", "versus": "Redkale" }, - "zgc": { - "plaintext_url": "/plaintext", - "json_url": "/json", + "fortune": { + "fortune_url": "/fortunes", "port": 8080, "approach": "Realistic", "classification": "Fullstack", @@ -94,13 +89,12 @@ "webserver": "Redkale", "os": "Linux", "database_os": "Linux", - "display_name": "redkale-io", + "display_name": "redkale", "notes": "", "versus": "Redkale" }, - "io": { - "plaintext_url": "/plaintext", - "json_url": "/json", + "update": { + "update_url": "/updates?q=", "port": 8080, "approach": "Realistic", "classification": "Fullstack", @@ -113,7 +107,7 @@ "webserver": "Redkale", "os": "Linux", "database_os": "Linux", - "display_name": "redkale-io", + "display_name": "redkale", "notes": "", "versus": "Redkale" } diff --git a/frameworks/Java/redkale/conf/application.xml b/frameworks/Java/redkale/conf/application.xml index 4bcc0112d6d..7e709c30812 100644 --- a/frameworks/Java/redkale/conf/application.xml +++ b/frameworks/Java/redkale/conf/application.xml @@ -6,12 +6,13 @@ + - + diff --git a/frameworks/Java/redkale/config.toml b/frameworks/Java/redkale/config.toml index f2bcfa25230..1983c168f36 100644 --- a/frameworks/Java/redkale/config.toml +++ b/frameworks/Java/redkale/config.toml @@ -6,7 +6,7 @@ urls.plaintext = "/plaintext" urls.json = "/json" approach = "Realistic" classification = "Fullstack" -database = "None" +database = "Postgres" database_os = "Linux" os = "Linux" orm = "Raw" @@ -26,11 +26,8 @@ platform = "Redkale" webserver = "Redkale" versus = "Redkale" -[postgres] +[db] urls.db = "/db" -urls.fortune = "/fortunes" -urls.query = "/queries?q=" -urls.update = "/updates?q=" approach = "Realistic" classification = "Fullstack" database = "Postgres" @@ -41,12 +38,11 @@ platform = "Redkale" webserver = "Redkale" versus = "Redkale" -[io] -urls.plaintext = "/plaintext" -urls.json = "/json" +[fortune] +urls.fortune = "/fortunes" approach = "Realistic" classification = "Fullstack" -database = "None" +database = "Postgres" database_os = "Linux" os = "Linux" orm = "Raw" @@ -54,12 +50,11 @@ platform = "Redkale" webserver = "Redkale" versus = "Redkale" -[jdk16] -urls.plaintext = "/plaintext" -urls.json = "/json" +[query] +urls.query = "/queries?q=" approach = "Realistic" classification = "Fullstack" -database = "None" +database = "Postgres" database_os = "Linux" os = "Linux" orm = "Raw" @@ -67,15 +62,15 @@ platform = "Redkale" webserver = "Redkale" versus = "Redkale" -[zgc] -urls.plaintext = "/plaintext" -urls.json = "/json" +[update] +urls.update = "/updates?q=" approach = "Realistic" classification = "Fullstack" -database = "None" +database = "Postgres" database_os = "Linux" os = "Linux" orm = "Raw" platform = "Redkale" webserver = "Redkale" versus = "Redkale" + diff --git a/frameworks/Java/redkale/redkale-cache.dockerfile b/frameworks/Java/redkale/redkale-cache.dockerfile index 8e7552fb8b1..173f5708d3b 100644 --- a/frameworks/Java/redkale/redkale-cache.dockerfile +++ b/frameworks/Java/redkale/redkale-cache.dockerfile @@ -1,15 +1,15 @@ -FROM maven:3.6.1-jdk-11-slim as maven +FROM maven:3.6.3-openjdk-16-slim as maven WORKDIR /redkale COPY src src COPY conf conf COPY pom.xml pom.xml RUN mvn package -q -FROM openjdk:11.0.3-jdk-slim +FROM openjdk:16-jdk-slim WORKDIR /redkale COPY conf conf COPY --from=maven /redkale/target/redkale-benchmark-1.0.0.jar redkale-benchmark.jar EXPOSE 8080 -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-Dbenchmarks.cache=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] +CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=20000", "-Dbenchmarks.cache=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] diff --git a/frameworks/Java/redkale/redkale-jdk16.dockerfile b/frameworks/Java/redkale/redkale-db.dockerfile similarity index 77% rename from frameworks/Java/redkale/redkale-jdk16.dockerfile rename to frameworks/Java/redkale/redkale-db.dockerfile index 09f8f665881..38e8fe0c0f6 100644 --- a/frameworks/Java/redkale/redkale-jdk16.dockerfile +++ b/frameworks/Java/redkale/redkale-db.dockerfile @@ -12,4 +12,4 @@ COPY --from=maven /redkale/target/redkale-benchmark-1.0.0.jar redkale-benchmark. EXPOSE 8080 -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=160000", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] +CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=20000", "-Dbenchmarks.db=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] diff --git a/frameworks/Java/redkale/redkale-zgc.dockerfile b/frameworks/Java/redkale/redkale-fortune.dockerfile similarity index 63% rename from frameworks/Java/redkale/redkale-zgc.dockerfile rename to frameworks/Java/redkale/redkale-fortune.dockerfile index e8174ab3508..38e8fe0c0f6 100644 --- a/frameworks/Java/redkale/redkale-zgc.dockerfile +++ b/frameworks/Java/redkale/redkale-fortune.dockerfile @@ -12,4 +12,4 @@ COPY --from=maven /redkale/target/redkale-benchmark-1.0.0.jar redkale-benchmark. EXPOSE 8080 -CMD ["java", "-server", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC", "-XX:AutoBoxCacheMax=160000", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] +CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=20000", "-Dbenchmarks.db=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] diff --git a/frameworks/Java/redkale/redkale-io.dockerfile b/frameworks/Java/redkale/redkale-query.dockerfile similarity index 62% rename from frameworks/Java/redkale/redkale-io.dockerfile rename to frameworks/Java/redkale/redkale-query.dockerfile index a1cf0456b78..38e8fe0c0f6 100644 --- a/frameworks/Java/redkale/redkale-io.dockerfile +++ b/frameworks/Java/redkale/redkale-query.dockerfile @@ -1,15 +1,15 @@ -FROM maven:3.6.1-jdk-11-slim as maven +FROM maven:3.6.3-openjdk-16-slim as maven WORKDIR /redkale COPY src src COPY conf conf COPY pom.xml pom.xml RUN mvn package -q -FROM openjdk:11.0.3-jdk-slim +FROM openjdk:16-jdk-slim WORKDIR /redkale COPY conf conf COPY --from=maven /redkale/target/redkale-benchmark-1.0.0.jar redkale-benchmark.jar EXPOSE 8080 -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-Dio.direct.fd=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] +CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=20000", "-Dbenchmarks.db=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] diff --git a/frameworks/Java/redkale/redkale-postgres.dockerfile b/frameworks/Java/redkale/redkale-update.dockerfile similarity index 62% rename from frameworks/Java/redkale/redkale-postgres.dockerfile rename to frameworks/Java/redkale/redkale-update.dockerfile index 8ba5a17e88d..38e8fe0c0f6 100644 --- a/frameworks/Java/redkale/redkale-postgres.dockerfile +++ b/frameworks/Java/redkale/redkale-update.dockerfile @@ -1,15 +1,15 @@ -FROM maven:3.6.1-jdk-11-slim as maven +FROM maven:3.6.3-openjdk-16-slim as maven WORKDIR /redkale COPY src src COPY conf conf COPY pom.xml pom.xml RUN mvn package -q -FROM openjdk:11.0.3-jdk-slim +FROM openjdk:16-jdk-slim WORKDIR /redkale COPY conf conf COPY --from=maven /redkale/target/redkale-benchmark-1.0.0.jar redkale-benchmark.jar EXPOSE 8080 -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] +CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=20000", "-Dbenchmarks.db=true", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] diff --git a/frameworks/Java/redkale/redkale.dockerfile b/frameworks/Java/redkale/redkale.dockerfile index 8ba5a17e88d..2f5508fc106 100644 --- a/frameworks/Java/redkale/redkale.dockerfile +++ b/frameworks/Java/redkale/redkale.dockerfile @@ -1,15 +1,15 @@ -FROM maven:3.6.1-jdk-11-slim as maven +FROM maven:3.6.3-openjdk-16-slim as maven WORKDIR /redkale COPY src src COPY conf conf COPY pom.xml pom.xml RUN mvn package -q -FROM openjdk:11.0.3-jdk-slim +FROM openjdk:16-jdk-slim WORKDIR /redkale COPY conf conf COPY --from=maven /redkale/target/redkale-benchmark-1.0.0.jar redkale-benchmark.jar EXPOSE 8080 -CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] +CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:AutoBoxCacheMax=20000", "-DAPP_HOME=./", "-jar", "redkale-benchmark.jar"] diff --git a/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Message.java b/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Message.java index 905e1b0612e..05b65cb3b48 100644 --- a/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Message.java +++ b/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Message.java @@ -14,6 +14,8 @@ */ public final class Message { + private static final Message instance = new Message(); + @ConvertSmallString private String message; @@ -24,6 +26,11 @@ public Message(String message) { this.message = message; } + public static Message create(String str) { + instance.message = str; + return instance; + } + public String getMessage() { return message; } diff --git a/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Service.java b/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Service.java index b3b2b645917..74a1c981cc9 100644 --- a/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Service.java +++ b/frameworks/Java/redkale/src/main/java/org/redkalex/benchmark/Service.java @@ -31,8 +31,8 @@ public class Service extends AbstractService { @Override public void init(AnyValue conf) { - if (source instanceof DataSqlSource) { - this.cache = ((DataSqlSource) source).loadCache(CachedWorld.class); + if (Boolean.getBoolean("benchmarks.cache")) { + this.cache = ((DataSqlSource) source).loadCache(CachedWorld.class).array(); } } @@ -41,9 +41,9 @@ public byte[] getHelloBytes() { return helloBytes; } - @RestMapping(name = "json") + @RestMapping(name = "json", length = 27) public Message getHelloMessage() { - return new Message("Hello, World!"); + return Message.create("Hello, World!"); } @RestMapping(name = "db") @@ -93,7 +93,7 @@ public CachedWorld[] cachedWorlds(int q) { final int size = Math.min(500, Math.max(1, q)); final CachedWorld[] worlds = new CachedWorld[size]; for (int i = 0; i < size; i++) { - worlds[i] = cache.find(randomId()); + worlds[i] = cache.findAt(randomId()); } return worlds; } diff --git a/frameworks/Java/redkale/src/main/templates/org/redkalex/benchmark/FortunesTemplate.rocker.html b/frameworks/Java/redkale/src/main/templates/org/redkalex/benchmark/FortunesTemplate.rocker.html index b314745d9d8..dc54b86e47e 100644 --- a/frameworks/Java/redkale/src/main/templates/org/redkalex/benchmark/FortunesTemplate.rocker.html +++ b/frameworks/Java/redkale/src/main/templates/org/redkalex/benchmark/FortunesTemplate.rocker.html @@ -1,18 +1,9 @@ @import org.redkalex.benchmark.Fortune @import java.util.List @args(List fortunes) - - + Fortunes - - - - - - @for (fortune : fortunes) { - - - - }
idmessage
@fortune.getId()@fortune.getMessage()
- - + +@for (fortune : fortunes) { +} +
idmessage
@fortune.getId()@fortune.getMessage()
diff --git a/frameworks/Python/api_hour/requirements.txt b/frameworks/Python/api_hour/requirements.txt index 44475e9a848..d45e196827c 100644 --- a/frameworks/Python/api_hour/requirements.txt +++ b/frameworks/Python/api_hour/requirements.txt @@ -10,7 +10,7 @@ Jinja2==2.11.3 MarkupSafe==0.23 piprot==0.9.1 psycopg2==2.7.5 -PyYAML==3.11 +PyYAML==5.4 requests==2.20.0 requests-futures==0.9.5 setproctitle==1.1.8 diff --git a/frameworks/Ruby/rails/Gemfile b/frameworks/Ruby/rails/Gemfile index 80100b37f48..492f8e66b14 100644 --- a/frameworks/Ruby/rails/Gemfile +++ b/frameworks/Ruby/rails/Gemfile @@ -1,9 +1,10 @@ source 'https://rubygems.org' do gem 'listen', '~> 3.3', group: :development gem 'mysql2', '0.5.3', group: :mysql - gem 'oj', '3.11.2' + gem 'oj', '~> 3.11.2' gem 'pg', '1.2.3', group: :postgresql - gem 'puma', '5.2.1' - gem 'rails', '6.1.3' + gem 'puma', '~> 5.2.1' + gem 'rails', '~> 6.1.3' + gem 'redis', '~> 4.0' gem 'tzinfo-data', '1.2021.1' end \ No newline at end of file diff --git a/frameworks/Ruby/rails/Gemfile.lock b/frameworks/Ruby/rails/Gemfile.lock index f724daac6d1..7aeaa3e10e6 100644 --- a/frameworks/Ruby/rails/Gemfile.lock +++ b/frameworks/Ruby/rails/Gemfile.lock @@ -64,7 +64,7 @@ GEM concurrent-ruby (1.1.8) crass (1.0.6) erubi (1.10.0) - ffi (1.14.2) + ffi (1.15.0) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.9) @@ -82,14 +82,14 @@ GEM method_source (1.0.0) mimemagic (0.3.5) mini_mime (1.0.2) - minitest (5.14.3) + minitest (5.14.4) mysql2 (0.5.3) - nio4r (2.5.5) - nokogiri (1.11.1-arm64-darwin) + nio4r (2.5.7) + nokogiri (1.11.2-arm64-darwin) racc (~> 1.4) - oj (3.11.2) + oj (3.11.3) pg (1.2.3) - puma (5.2.1) + puma (5.2.2) nio4r (~> 2.0) racc (1.5.2) rack (2.2.3) @@ -125,6 +125,7 @@ GEM rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) + redis (4.2.5) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -148,10 +149,11 @@ PLATFORMS DEPENDENCIES listen (~> 3.3)! mysql2 (= 0.5.3)! - oj (= 3.11.2)! + oj (~> 3.11.2)! pg (= 1.2.3)! - puma (= 5.2.1)! - rails (= 6.1.3)! + puma (~> 5.2.1)! + rails (~> 6.1.3)! + redis (~> 4.0)! tzinfo-data (= 1.2021.1)! BUNDLED WITH diff --git a/frameworks/Ruby/rails/README.md b/frameworks/Ruby/rails/README.md index a9e3f58be99..03b227b8409 100644 --- a/frameworks/Ruby/rails/README.md +++ b/frameworks/Ruby/rails/README.md @@ -17,12 +17,13 @@ The tests were run with: - [Puma 5.2.1](http://puma.io/) - [MySQL 5.5](https://dev.mysql.com/) - [PostgreSQL 11](https://www.postgresql.org/) - +- [Redis 5.0](https://redis.io) ## Paths & Source for Tests - [JSON Serialization](app/controllers/hello_world_controller.rb): "/json" - [Single Database Query](app/controllers/hello_world_controller.rb): "/db", [World Model](app/models/world.rb) -- [Multiple Database Queries](app/controllers/hello_world_controller.rb): "/db?queries={#}", [World Model](app/models/world.rb) +- [Multiple Database Queries](app/controllers/hello_world_controller.rb): "/queries?queries={#}", [World Model](app/models/world.rb) +- [Cached Database Queries](app/controllers/hello_world_controller.rb): "/cached?queries={#}", [World Model] - [Fortunes](app/controllers/hello_world_controller.rb): "/fortune" , [Fortunes Model](app/models/fortune.rb) - [Database Updates](app/controllers/hello_world_controller.rb): "/update?queries={#}", [World Model](app/models/world.rb) - [Plaintext](app/controllers/hello_world_controller.rb): "/plaintext" @@ -42,4 +43,3 @@ The tests were run with: ### Resources - [Ruby on Rails Source Code](https://github.com/rails/rails) -- [PR: passenger-install-apache2-module doesn't work on ruby 2.0](https://github.com/FooBarWidget/passenger/pull/71) diff --git a/frameworks/Ruby/rails/app/controllers/application_controller.rb b/frameworks/Ruby/rails/app/controllers/application_controller.rb index bc62d8e6dda..312bea18d1a 100644 --- a/frameworks/Ruby/rails/app/controllers/application_controller.rb +++ b/frameworks/Ruby/rails/app/controllers/application_controller.rb @@ -1,11 +1,10 @@ +# frozen_string_literal: true class ApplicationController < ActionController::Base - before_action :add_header -protected + private def add_header response.set_header('Date', Time.now.httpdate) end - end diff --git a/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb b/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb index b0677e1b951..ed5e52f3894 100644 --- a/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb +++ b/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb @@ -16,53 +16,50 @@ def db end def query - queries = params[:queries].to_i - queries = 1 if queries < 1 - queries = 500 if queries > 500 - - results = QUERY_RANGE.sample(queries).map do |id| + results = QUERY_RANGE.sample(query_count).map do |id| World.find(id) end render json: results end + def cached_query + results = QUERY_RANGE.sample(query_count).map do |id| + Rails.cache.fetch(id) do + World.find(id).as_json + end + end + + render json: results + end + def fortune @fortunes = Fortune.all.to_a @fortunes << Fortune.new(id: 0, message: 'Additional fortune added at request time.') - @fortunes = @fortunes.sort_by!(&:message) + @fortunes.sort_by!(&:message) end def update - queries = (params[:queries] || 1).to_i - queries = 1 if queries < 1 - queries = 500 if queries > 500 - - worlds = queries.times.map{Random.rand(1..10_000)}.map do |id| + worlds = query_count.times.map { Random.rand(1..10_000) }.map do |id| # get a random row from the database, which we know has 10000 # rows with ids 1 - 10000 - world = World.select(:id, :randomNumber).find(id) - begin - rn = Random.rand(1..10_000) - end while rn == world.randomNumber - world.update_column(:randomNumber, rn) + world = World.find(id) + random = Random.rand(1..10_000) + random = Random.rand(1..10_000) until random != world.randomNumber + world.update_columns(randomNumber: random) world end render json: worlds end - def cached_query - queries = params[:queries].to_i - queries = 1 if queries < 1 - queries = 500 if queries > 500 + private - results = QUERY_RANGE.sample(queries).map do |id| - Rails.cache.fetch("world-#{id}") do - World.find(id) - end - end + def query_count + queries = params[:queries].to_i + return 1 if queries < 1 + return 500 if queries > 500 - render json: results + queries end end diff --git a/frameworks/Ruby/rails/config/environments/production.rb b/frameworks/Ruby/rails/config/environments/production.rb index 8a12685ea32..053aabf89a1 100644 --- a/frameworks/Ruby/rails/config/environments/production.rb +++ b/frameworks/Ruby/rails/config/environments/production.rb @@ -28,7 +28,17 @@ config.log_tags = [ :request_id ] # Use a different cache store in production. - config.cache_store = :memory_store + config.cache_store = :redis_cache_store, { + url: ENV['REDIS_URL'], + connect_timeout: 30, # Defaults to 20 seconds + read_timeout: 0.2, # Defaults to 1 second + write_timeout: 0.2, # Defaults to 1 second + reconnect_attempts: 1, # Defaults to 0 + + error_handler: -> (method:, returning:, exception:) { + puts "NO REDIS DETECTED" + } + } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). diff --git a/frameworks/Ruby/rails/rails-mysql.dockerfile b/frameworks/Ruby/rails/rails-mysql.dockerfile index bc4571ea3a0..41174362aef 100644 --- a/frameworks/Ruby/rails/rails-mysql.dockerfile +++ b/frameworks/Ruby/rails/rails-mysql.dockerfile @@ -1,16 +1,18 @@ FROM ruby:3.0 -ENV BUNDLE_WITHOUT=postgresql -ENV RAILS_ENV=production_mysql -ENV PORT=8080 +RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends redis-server EXPOSE 8080 WORKDIR /rails COPY ./Gemfile* /rails/ +ENV BUNDLE_WITHOUT=postgresql RUN bundle install --jobs=8 COPY . /rails/ -CMD ["rails", "server"] \ No newline at end of file +ENV RAILS_ENV=production_mysql +ENV PORT=8080 +ENV REDIS_URL=redis://localhost:6379/0/cache +CMD ./run-with-redis.sh \ No newline at end of file diff --git a/frameworks/Ruby/rails/rails.dockerfile b/frameworks/Ruby/rails/rails.dockerfile index d1d198ff1ad..4c6f2400c2d 100644 --- a/frameworks/Ruby/rails/rails.dockerfile +++ b/frameworks/Ruby/rails/rails.dockerfile @@ -1,16 +1,18 @@ FROM ruby:3.0 -ENV BUNDLE_WITHOUT=mysql -ENV RAILS_ENV=production_postgresql -ENV PORT=8080 +RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends redis-server EXPOSE 8080 WORKDIR /rails COPY ./Gemfile* /rails/ +ENV BUNDLE_WITHOUT=mysql RUN bundle install --jobs=8 COPY . /rails/ -CMD ["rails", "server"] \ No newline at end of file +ENV RAILS_ENV=production_postgresql +ENV PORT=8080 +ENV REDIS_URL=redis://localhost:6379/0/cache +CMD ./run-with-redis.sh \ No newline at end of file diff --git a/frameworks/Ruby/rails/run-with-redis.sh b/frameworks/Ruby/rails/run-with-redis.sh new file mode 100755 index 00000000000..9ce9b243b74 --- /dev/null +++ b/frameworks/Ruby/rails/run-with-redis.sh @@ -0,0 +1,3 @@ +#!/bin/bash +service redis-server start +rails server diff --git a/frameworks/Rust/faf/.gitignore b/frameworks/Rust/faf/.gitignore new file mode 100644 index 00000000000..4c97c40457d --- /dev/null +++ b/frameworks/Rust/faf/.gitignore @@ -0,0 +1,4 @@ +/target +/docs +/.vscode +/prof diff --git a/frameworks/Rust/faf/Cargo.toml b/frameworks/Rust/faf/Cargo.toml new file mode 100644 index 00000000000..432cb421243 --- /dev/null +++ b/frameworks/Rust/faf/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "faf-ex" +version = "0.1.0" +authors = ["James Bates "] +edition = "2018" + +[profile.release] +opt-level = 3 +panic = 'unwind' +codegen-units = 1 +lto = "thin" +debug = false +overflow-checks = false + +[dependencies] +mimalloc = { version = "*", default-features = false } +faf = { git = "https://github.com/errantmind/faf" } +#faf = { path = "/home/errant/dev/projects/faf-epoll" } diff --git a/frameworks/Rust/faf/README.md b/frameworks/Rust/faf/README.md new file mode 100644 index 00000000000..9f26cb0fc83 --- /dev/null +++ b/frameworks/Rust/faf/README.md @@ -0,0 +1,4 @@ +# faf +FaF is a Linux webserver written in Rust. It has a single goal: to demonstrate the upper bound of possible single-node performance. It is meant as a living reference project and may have cutting edge dependencies. Being a reference project, documentation and simplicity are essential and will be maintained to the best of my ability. + +[FaF Repo](https://github.com/errantmind/faf) diff --git a/frameworks/Rust/faf/benchmark_config.json b/frameworks/Rust/faf/benchmark_config.json new file mode 100644 index 00000000000..283500e21a3 --- /dev/null +++ b/frameworks/Rust/faf/benchmark_config.json @@ -0,0 +1,25 @@ +{ + "framework": "faf", + "tests": [ + { + "default": { + "plaintext_url": "/plaintext", + "port": 8089, + "approach": "Realistic", + "classification": "Platform", + "database": "None", + "framework": "faf", + "language": "Rust", + "flavor": "None", + "orm": "None", + "platform": "None", + "webserver": "None", + "os": "Linux", + "database_os": "None", + "display_name": "faf", + "notes": "", + "versus": "None" + } + } + ] +} diff --git a/frameworks/Rust/faf/config.toml b/frameworks/Rust/faf/config.toml new file mode 100644 index 00000000000..f086428aa5a --- /dev/null +++ b/frameworks/Rust/faf/config.toml @@ -0,0 +1,15 @@ +[framework] +name = "faf" + +[main] +urls.plaintext = "/plaintext" +# urls.json = "/j" +approach = "Realistic" +classification = "Platform" +database = "None" +database_os = "None" +os = "Linux" +orm = "None" +platform = "None" +webserver = "None" +versus = "None" diff --git a/frameworks/Rust/faf/faf.dockerfile b/frameworks/Rust/faf/faf.dockerfile new file mode 100644 index 00000000000..b738144ff78 --- /dev/null +++ b/frameworks/Rust/faf/faf.dockerfile @@ -0,0 +1,14 @@ +FROM errantmind/debian-faf:v2 + +COPY ./Cargo.toml ./Cargo.toml +COPY ./src ./src +COPY ./merged.profdata ./merged.profdata +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 +RUN /root/.cargo/bin/cargo update +RUN RUSTFLAGS="-Ctarget-cpu=native -Clinker=/usr/bin/clang-12 -Clink-arg=-fuse-ld=lld-12 -Clink-arg=-flto=thin \ + -Clto=thin -Cembed-bitcode=yes -Copt-level=3 -Ccodegen-units=1 -Cforce-frame-pointers=n -Cprofile-use=/faf/merged.profdata" \ + /root/.cargo/bin/cargo build --verbose --release && strip --strip-all target/release/faf-ex + +EXPOSE 8089 +CMD ./target/release/faf-ex diff --git a/frameworks/Rust/faf/merged.profdata b/frameworks/Rust/faf/merged.profdata new file mode 100644 index 00000000000..5e0bf74e180 Binary files /dev/null and b/frameworks/Rust/faf/merged.profdata differ diff --git a/frameworks/Rust/faf/src/main.rs b/frameworks/Rust/faf/src/main.rs new file mode 100644 index 00000000000..38df62a5585 --- /dev/null +++ b/frameworks/Rust/faf/src/main.rs @@ -0,0 +1,97 @@ +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + +use faf::const_concat_bytes; +use faf::const_config::*; +use faf::const_http::*; +use faf::extern_http_date; +use faf::util::{const_len, memcmp}; + +const ROUTE_PLAINTEXT: &[u8] = b"/p"; +const ROUTE_PLAINTEXT_LEN: usize = const_len(ROUTE_PLAINTEXT); +const ROUTE_JSON: &[u8] = b"/j"; +const ROUTE_JSON_LEN: usize = const_len(ROUTE_JSON); + +const TEXT_PLAIN_CONTENT_TYPE: &[u8] = b"Content-Type: text/plain"; +const CONTENT_LENGTH: &[u8] = b"Content-Length: "; +const PLAINTEXT_BODY: &[u8] = b"Hello, World!"; +const PLAINTEXT_BODY_LEN: usize = const_len(PLAINTEXT_BODY); +const PLAINTEXT_BODY_SIZE: &[u8] = b"13"; + +const PLAINTEXT_BASE: &[u8] = const_concat_bytes!( + HTTP_200_OK, + CRLF, + SERVER, + CRLF, + TEXT_PLAIN_CONTENT_TYPE, + CRLF, + CONTENT_LENGTH, + PLAINTEXT_BODY_SIZE, + CRLF +); + +const PLAINTEXT_BASE_LEN: usize = const_len(PLAINTEXT_BASE); + +#[inline] +fn cb( + method: *const i8, + method_len: usize, + path: *const i8, + path_len: usize, + _headers: &[faf::phr_header; MAX_HEADERS_TO_PARSE], + _num_headers: usize, + response_buffer: &mut [u8; REQ_RES_BUFF_SIZE], +) -> usize { + if method_len < GET_LEN || path_len < ROUTE_PLAINTEXT_LEN { + return 0; + } + unsafe { + if memcmp(GET.as_ptr() as *const i8, method, GET_LEN) == 0 { + // For performance purposes, this will successfully match '/p' to '/plaintext' and '/pickle'. Use with caution + if memcmp(ROUTE_PLAINTEXT.as_ptr() as *const i8, path, ROUTE_PLAINTEXT_LEN) == 0 { + let mut date_buff = crate::extern_http_date::get_buff_with_date(); + extern_http_date::get_http_date(&mut date_buff); + std::ptr::copy_nonoverlapping(PLAINTEXT_BASE.as_ptr(), response_buffer.as_mut_ptr(), PLAINTEXT_BASE_LEN); + std::ptr::copy_nonoverlapping( + date_buff.as_ptr(), + response_buffer.as_mut_ptr().add(PLAINTEXT_BASE_LEN), + DATE_LEN, + ); + std::ptr::copy_nonoverlapping( + CRLFCRLF.as_ptr(), + response_buffer.as_mut_ptr().add(PLAINTEXT_BASE_LEN + DATE_LEN), + CRLFCRLF_LEN, + ); + std::ptr::copy_nonoverlapping( + PLAINTEXT_BODY.as_ptr(), + response_buffer.as_mut_ptr().add(PLAINTEXT_BASE_LEN + DATE_LEN + CRLFCRLF_LEN), + PLAINTEXT_BODY_LEN, + ); + + return PLAINTEXT_BASE_LEN + DATE_LEN + CRLFCRLF_LEN + PLAINTEXT_BODY_LEN; + } else if memcmp(ROUTE_JSON.as_ptr() as *const i8, path, ROUTE_JSON_LEN) == 0 { + } else { + std::ptr::copy_nonoverlapping( + HTTP_404_NOTFOUND.as_ptr(), + response_buffer.as_mut_ptr(), + HTTP_404_NOTFOUND_LEN, + ); + return HTTP_404_NOTFOUND_LEN; + } + } else { + std::ptr::copy_nonoverlapping( + HTTP_405_NOTALLOWED.as_ptr(), + response_buffer.as_mut_ptr(), + HTTP_405_NOTALLOWED_LEN, + ); + return HTTP_405_NOTALLOWED_LEN; + } + }; + + 0 +} + +#[inline] +fn main() { + faf::epoll::go(8089, cb); +} diff --git a/frameworks/Scala/finagle/build.sbt b/frameworks/Scala/finagle/build.sbt index b7a4ed1659e..14d960f2eac 100644 --- a/frameworks/Scala/finagle/build.sbt +++ b/frameworks/Scala/finagle/build.sbt @@ -1,7 +1,7 @@ -lazy val finagleVersion = "21.2.0" +lazy val finagleVersion = "21.3.0" name := "finagle-benchmark" -scalaVersion := "2.12.8" +scalaVersion := "2.12.12" version := finagleVersion libraryDependencies ++= Seq( diff --git a/frameworks/Scala/finatra/build.sbt b/frameworks/Scala/finatra/build.sbt index fa1b0e16c6d..bc5f9c44d27 100644 --- a/frameworks/Scala/finatra/build.sbt +++ b/frameworks/Scala/finatra/build.sbt @@ -1,10 +1,10 @@ -lazy val finatraVersion = "21.2.0" +lazy val finatraVersion = "21.3.0" name := "techempower-benchmarks-finatra" organization := "com.twitter" version := finatraVersion -scalaVersion := "2.12.8" +scalaVersion := "2.12.12" resolvers ++= Seq( Resolver.sonatypeRepo("releases") @@ -18,7 +18,7 @@ assemblyMergeStrategy in assembly := { case other => MergeStrategy.first} libraryDependencies ++= Seq( - ("com.twitter" %% "finatra-http" % finatraVersion). + ("com.twitter" %% "finatra-http-server" % finatraVersion). exclude("com.sun.activation", "javax.activation"), "org.slf4j" % "slf4j-nop" % "1.7.30", "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.11.2", diff --git a/toolset/.gitignore b/toolset/.gitignore new file mode 100644 index 00000000000..0d20b6487c6 --- /dev/null +++ b/toolset/.gitignore @@ -0,0 +1 @@ +*.pyc