Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b129c92
add readme, analysis, config and ignore files
iapicca Jan 1, 2026
3a47013
cp bin from dart3 and add aot specific dockerfile
iapicca Jan 1, 2026
e6acf04
rename dockerfile update pubspec
iapicca Jan 1, 2026
26e7104
implement multi-group isolate scaling for AOT deployment
iapicca Jan 1, 2026
7bf4b01
fix 'framework' and 'display_name' in 'benchmark_config'
iapicca Jan 2, 2026
19e07a8
Update hyperlane (#10480)
eastspire Jan 2, 2026
ed0fa57
Express: optimize some slower/poor implementation (#10481)
nigrosimone Jan 2, 2026
6cb08a0
[ruby] Move database logic to seperate files for clarity (#10484)
p8 Jan 2, 2026
d173d19
[ruby/grape] Update to 3.0 (#10485)
p8 Jan 2, 2026
b39651d
[ruby/rack] Try ZJIT (#10486)
p8 Jan 2, 2026
f593e18
[ruby/rack-sequel] Increase threads instead of workers (#10487)
p8 Jan 2, 2026
942a46c
[ruby] Set puma workers to 1.25 * nproc (#10488)
p8 Jan 2, 2026
c694a34
[ruby/rage] Remove logger from Gemfile (#10490)
p8 Jan 2, 2026
6816c7c
[ruby/rage] Update ActiveRecord to 8.1 (#10491)
p8 Jan 2, 2026
1d21472
vertx-web-kotlin-dsljson updates (#10492)
awmcc90 Jan 2, 2026
ba19762
Dart3 update (#10493)
iapicca Jan 2, 2026
ed0ecd7
[ruby/rails] Remove references to Agoo (#10489)
p8 Jan 2, 2026
8598b58
mv .dockarfile under dart3 and update dart3 benchmark_config
iapicca Jan 3, 2026
373d733
include AOT horizontal scaling logic
iapicca Jan 3, 2026
6a66ad2
update dart3_aot.dockerfile to include MAX_ISOLATES arg
iapicca Jan 3, 2026
52806e2
align dart3. dart3_aot. dockerfile(s), and update run.sh
iapicca Jan 3, 2026
5c0b657
clean up comments formatting in server.dart
iapicca Jan 3, 2026
3ee3850
delete dart3_aot folder
iapicca Jan 3, 2026
6c87da4
Merge branch 'master' into dart_aot
iapicca Jan 3, 2026
9b726cd
renaming .dockerfile dart3_aot to dart3-aot to make the CI happy
iapicca Jan 3, 2026
f6f8885
update benchmark_config 'default' test and 'display_name's
iapicca Jan 3, 2026
7098489
fix benchmark_config naming error
iapicca Jan 3, 2026
ab8e396
add error handling and internalServerError Response
iapicca Jan 3, 2026
65d7d9c
remove duplicate 'if' statement
iapicca Jan 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions frameworks/Dart/dart3/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@
"framework": "dart3",
"tests": [
{
"default": {
"default": {
"display_name": "dart3_native",
"json_url": "/json",
"plaintext_url": "/plaintext",
"port": 8080,
"approach": "Stripped",
"classification": "Platform",
"database": "None",
"framework": "None",
"language": "Dart",
"flavor": "None",
"orm": "None",
"platform": "None",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "dart3",
"notes": "",
"versus": "None"
"database_os": "Linux"
}
},
{
"aot": {
"display_name": "dart3_aot",
"json_url": "/json",
"plaintext_url": "/plaintext",
"port": 8080,
"approach": "Stripped",
"classification": "Platform",
"database": "None",
"language": "Dart",
"os": "Linux",
"database_os": "Linux"
}
}
]
}
}
76 changes: 69 additions & 7 deletions frameworks/Dart/dart3/bin/server.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,62 @@
import 'dart:convert';
import 'dart:io';
import 'dart:isolate';
import 'dart:math' show min;

/// Environment declarations are evaluated at compile-time. Use 'const' to
/// ensure values are baked into AOT/Native binaries for the benchmark.
///
/// From https://api.dart.dev/dart-core/int/int.fromEnvironment.html:
/// "This constructor is only guaranteed to work when invoked as const.
/// It may work as a non-constant invocation on some platforms
/// which have access to compiler options at run-time,
/// but most ahead-of-time compiled platforms will not have this information."
const _maxIsolatesfromEnvironment = int.fromEnvironment('MAX_ISOLATES');

void main(List<String> args) async {
/// Isolate count per process, set at build-time via:
/// dart compile exe --define=MAX_ISOLATES=X
/// Defaults to machine core count for dynamic scaling.
final maxIsolates = int.fromEnvironment(
'MAX_ISOLATES',
defaultValue: Platform.numberOfProcessors,
);
/// Defines local isolate quota, using MAX_ISOLATES if provided.
/// Falls back to total available cores while respecting hardware limits.
var maxIsolates = _maxIsolatesfromEnvironment > 0
? min(_maxIsolatesfromEnvironment, Platform.numberOfProcessors)
: Platform.numberOfProcessors;

/// Triggers process-level horizontal scaling when running in AOT.
if (Platform.script.toFilePath().endsWith('.aot')) {
/// Internal token used to notify newly spawned processes that they
/// belong to a secondary "worker group".
const workerGroupTag = '--workerGroup';

/// Determine if this process instance was initialized as a worker group.
final isWorkerGroup = args.contains(workerGroupTag);

if (isWorkerGroup) {
/// Sanitize the argument list to ensure the internal token does not
/// interfere with application-level argument parsing.
args.removeAt(args.indexOf(workerGroupTag));
}
/// Prevents recursive spawning
/// by ensuring only the primary process can spawn worker groups
else {
/// Calculate the number of secondary worker groups required
/// to fully utilize the available hardware capacity.
///
/// Each group serves as a container for multiple isolates,
/// helping to bypass internal VM scaling bottlenecks.
final workerGroups = Platform.numberOfProcessors ~/ maxIsolates - 1;

/// Bootstraps independent worker processes via AOT snapshots.
/// Each process initializes its own Isolate Group.
for (var i = 0; i < workerGroups; i++) {
/// [Platform.script] identifies the AOT snapshot or executable.
/// [Isolate.spawnUri] spawns a new process group via [main()].
Isolate.spawnUri(Platform.script, [workerGroupTag, ...args], null);
}

/// Updates local isolate limits, assigning the primary group
/// the remaining cores after worker group allocation.
maxIsolates = Platform.numberOfProcessors - workerGroups * maxIsolates;
}
}

/// Create an [Isolate] containing an [HttpServer]
/// for each processor after the first
Expand Down Expand Up @@ -37,6 +84,19 @@ Future<void> _startServer(List<String> _) async {

/// Handles [HttpRequest]'s from [HttpServer].
await for (final request in server) {
/// Asynchronously processes each request with an 8-second safety deadline
/// to prevent stalled connections from blocking the isolate event loop.
_handleRequest(request).timeout(
const Duration(seconds: 8),
onTimeout: () => _sendResponse(request, HttpStatus.internalServerError),
);
}
}

/// Dispatches requests to specific test handlers. Wrapped in a try-catch
/// to ensure stable execution and guaranteed response delivery.
Future<void> _handleRequest(HttpRequest request) async {
try {
switch (request.uri.path) {
case '/json':
_jsonTest(request);
Expand All @@ -47,6 +107,8 @@ Future<void> _startServer(List<String> _) async {
default:
_sendResponse(request, HttpStatus.notFound);
}
} catch (e) {
_sendResponse(request, HttpStatus.internalServerError);
}
}

Expand Down
24 changes: 24 additions & 0 deletions frameworks/Dart/dart3/dart3-aot.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

FROM dart:3.10.7 AS build
WORKDIR /app

# Define the build-time argument (Default to 8)
ARG MAX_ISOLATES=8

COPY pubspec.yaml .
COPY bin bin

RUN dart compile aot-snapshot bin/server.dart \
--define=MAX_ISOLATES=${MAX_ISOLATES} \
-o server.aot

FROM gcr.io/distroless/base-debian12
WORKDIR /app

COPY --from=build /usr/lib/dart/bin/dartaotruntime /usr/lib/dart/bin/dartaotruntime
COPY --from=build /app/server.aot /app/server.aot

EXPOSE 8080

# Distroless requires absolute paths
ENTRYPOINT ["/usr/lib/dart/bin/dartaotruntime", "/app/server.aot"]
19 changes: 11 additions & 8 deletions frameworks/Dart/dart3/dart3.dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@

FROM dart:3.10.7 AS builder
FROM dart:3.10.7 AS build
WORKDIR /app

# Define the build-time argument (Default to 8)
ARG MAX_ISOLATES=8
COPY . .
RUN mkdir build

COPY pubspec.yaml .
COPY bin bin

RUN dart compile exe bin/server.dart \
--define=MAX_ISOLATES=${MAX_ISOLATES} \
-o build/server
-o server

FROM busybox:glibc
WORKDIR /app

# Re-declare ARG in the second stage to use it in ENV
# Define the build-time argument (Default to 8)
# Re-declare ARG 'MAX_ISOLATES' in the second stage to use it in ENV
ARG MAX_ISOLATES=8
ENV MAX_ISOLATES_PER_PROCESS=${MAX_ISOLATES}

COPY --from=builder /runtime/ /
COPY --from=builder /app/build/server /bin/server
COPY --from=build /runtime/ /
COPY --from=build /app/server /app/server
COPY run.sh /bin/run.sh

RUN chmod +x /bin/run.sh

EXPOSE 8080
Expand Down
6 changes: 3 additions & 3 deletions frameworks/Dart/dart3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ MAX_ISO=${MAX_ISOLATES_PER_PROCESS}
NUM_WORKERS=$((TOTAL_CORES / MAX_ISO))
if [ "$NUM_WORKERS" -le 0 ]; then NUM_WORKERS=1; fi

echo "Scaling: $TOTAL_CORES cores / $MAX_ISO isolates = $NUM_WORKERS processes"

# Bootstrap the calculated number of independent Dart processes.
for i in $(seq 1 $NUM_WORKERS); do
/bin/server &
/app/server &
done

# Keep the shell alive to manage the backgrounded process group.
wait
Loading