You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 18, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 18, 2021. It is now read-only.
Create a new aqueduct project with aqueduct create test_project
Go to test_project and run dart2aot bin/main.dart bin/main.dart.aot
Problem:
You get this error :
dart2aot bin/main.dart bin/main.dart.aot
error: import of dart:mirrors with --enable-mirrors=false
Cause:
Like the case of Flutter, the package 'mirrors' doesn't work with aot compilation ... No workaround, just find a way to replace it (with reflectable for example which is ok with aot)
Reacted by Ivan Tugay, Alvaro Vasconcelos, Jonathan Rezende, Jimmy Aumard, Gregory Sech, Herbert Poul, Rafael, pycebs, AlexanderArendar, Iiro Krankka and 13 more
How does this compare to snapshotting? A simple, snapshotted Aqueduct app is showing up as 39.6MB of runtime memory usage.
What is the actual reduction in startup time? How is deployment easier? How is the Docker image 'lighter'? How is the overall performance improved compared to JIT for a long-running process like a server application?
No runtime, only dartaotruntime executable, your dart.aot and dart.aot.dill files (plus your assets if needed)
How is the Docker image 'lighter'?
Cause of previous point, we don't need google dart image (with runtime) and we can use alpine image for example (maybe scratch with some effort ?)
How is the overall performance improved compared to JIT for a long-running process like a server application?
Tests on my computer show me better performance overall for my simple REST API (response time, processing data). I don't have enough back to argue about long-running process (cause yes I know we loose one of the advantage of JIT on this point).
I just fired up a snapshotted Aqueduct application and startup time was effectively instantaneous - I'm not sure applications that run for days/weeks/months at a time need a millisecond-order-of-magnitude improvement at startup.
Is deployment really easier? If you're containerizing, I don't see much of a difference here?
Is there a way to measure the size of a Docker image for an AOT vs. JIT compiled images? What are the actual savings quantified? Is there an example of this Dockerfile available?
In your performance testing, have you accounted for JIT? I'm not sure how runtime performance would be any different once the VM is warmed up. What are the actual tests & their measurements you are evaluating here?
Is deployment really easier? If you're containerizing, I don't see much of a difference here?
In my case, I containerize my app but maybe not everybody ...
Is there a way to measure the size of a Docker image for an AOT vs. JIT compiled images? What are the actual savings quantified? Is there an example of this Dockerfile available?
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sample-dart-aot latest d68f6c7606a3 About a minute ago 117MB
sample-dart-jit latest 8415ce919ec0 About an hour ago 637MB
sample-dart-snapshot latest aa7545a373b6 About an hour ago 640MB
Stats :
docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
8ceb16264950 sample-dart-aot-app 0.00% 16.81MiB / 1.934GiB 0.85% 788B / 0B 0B / 0B 2
e9775c0f7255 sample-dart-snapshot-app 0.00% 45.92MiB / 1.934GiB 2.32% 2.02kB / 0B 2.54MB / 0B 6
a59faf594521 sample-dart-jit-app 0.00% 131.9MiB / 1.934GiB 6.66% 2.2kB / 0B 2.38MB / 0B 7
In your performance testing, have you accounted for JIT? I'm not sure how runtime performance would be any different once the VM is warmed up. What are the actual tests & their measurements you are evaluating here?
As I said before, I don't have enough back to argue much more on performance. Dart 2.3 is not actually official, I only tested with my case (REST API without templating, etc ...). I can't give you full bench or other. Btw, compare VM warmed up (optimized only for some critical paths and after a huge? delay and amount of calls) against an aot build is not the best idea imo.
Reacted by Rafael, David, Vince Varga, Niklas Higi, Camelo, Sacchi and Andrey Gordeev
The disk size of the image is significant and worth looking at. There is not a way to disable mirrors right now. We will look at solutions for producing AOT builds. Thanks for putting together the numbers.
Reacted by Luca Ivaldi, mnordine and Max Weber
Reacted by Rafael, William N., Camelo, Sacchi and MahmoudSalah37
I updated the aot docker image in my sample project. It's even better
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sample-dart-snapshot latest 240ef99f0d4e 45 seconds ago 640MB
sample-dart-jit latest 1a556a3f72fd 2 minutes ago 637MB
sample-dart-aot latest c36a0f6bd7d0 16 minutes ago 32.5MB
Reacted by Ivan Tugay, Alvaro Vasconcelos, Sacha Arbonel, Dominik Seger, Jonathan Rezende, Virgiawan Huda Akbar, Tim Blackbird, Luca Ivaldi, Patrik Strömstedt, William N. and 29 more
Reacted by Virgiawan Huda Akbar, Luke Pighetti, Rody Davis and AirborneEagle
Reacted by Rafael, Luke Pighetti, Sacchi, Troy Gercek, Rody Davis, AirborneEagle and Leandro Lucarella
Reacted by Rafael, William N., Luke Pighetti, Ryan Knell, Rody Davis, MahmoudSalah37, Jermaine Oppong and AirborneEagle
The first phase of this effort is complete. The effort removed all reflection from the framework and moved it to a separate runtime library (that is used by default when running your application).
The next phase will add a aqueduct build command that 1) generates a runtime library that doesn't use reflection specific to your project and 2) compiles an AOT build of your project that links to that runtime library instead of the reflection-based runtime.
The end result is that you'll be able to run/debug quickly using the same way you do currently (using reflection). When you are ready to ship, you will run aqueduct build and it will emit a single binary of your application. edit: The compiled binary will take the same arguments as aqueduct serve.
Reacted by Luke Pighetti, Noor Dawod, Moacir Schmidt, pycebs, Alejandro Jaramillo Corrales, Sung-Chul Lee, Ihar Petushkou and Sasha Chudesnov
Reacted by Luke Pighetti
Reacted by Jonathan Rezende, Tim Blackbird, yxwzyyk, Sylvain Rio, Luca Ivaldi, Kevin Wang, Rafael, Patrik Strömstedt, Héctor Álvarez Díaz, Sacha Arbonel and 12 more
Reacted by Rafael, Gregory Sech, Alvaro Vasconcelos, Luke Pighetti, Sacchi, Noor Dawod, Ben Barbersmith and Víctor Diví
Reacted by Rafael, Gregory Sech, Luke Pighetti and Noor Dawod
Moving the runtime library generation out of Aqueduct into its own package; this is critical since safe_config is also mirrors-based and needs to provide its own runtime.
Creating tooling to generate runtimes and swap them in for Aqueduct test files; this is how we'll get to the same test coverage for mirror/generated runtimes.
Provide generated runtimes that pass tests
Reacted by William N., Jonathan Rezende, Patrik Strömstedt, Sacchi, Noor Dawod, Matt Clarkson, Moacir Schmidt, Kirill Mironov, Alvaro Vasconcelos, Ben Barbersmith and 6 more
I'm using this framework for a backend i'm writing. I've been following this thread and I'm hoping to launch my backend service with this. Please tell me this effort isn't abandoned!
It's not abandoned, but it has certainly slowed down as we grapple with a post-Covid business landscape. This feature does exist in the 3.3.0-b1 release, but the dependency on analyzer caused issues with dependency resolution for non-prerelease users. I'd like to push a 4.0.0-b1 with this feature to pub this week.
Reacted by Jonas Sander, Luke Pighetti, Rafael, Alvaro Vasconcelos and Matt Dondo
Why don't you use a builder (like json_serializable) for the ORM during dev-process. So it would be possible to start the server with >dart "appName" (JIT) or to compile the server with >dart2native + start. No more mirrors/reflections.
Reacted by Herbert Poul, Dave Jensen and Lukas Treyer
Can aqueduct: 4.0.0-b1 be used as a dependency for Flutter project? I'm trying to use it, but still getting Dart Error: error: import of dart:mirrors is not supported in the current Dart runtime
IMO you cannot. And I don't even see it as a healthy approach.
That error is simply related to the fact that currently Aqueduct uses dart:mirrors, and during the AOT build it generates the artifacts (instead of doing the reflection at runtime). That is one of the main features of 4.0.0-b1 version.
Flutter and Aqueduct have different build processes.
Related to the need:
If you want to share some models (and logic), an external model lib might help.
Still, you may want to have the back-end and front-end sides totally independent, thus giving more flexibility and freedom.
Ah, such a pity. Aqueduct ORM's Serialize doesn't integrate with json_serializable at all, so I thought I could use models on both sides.
It seems the only way is to implement toJson/fromJson on the client side manually, which is a huge drawback.
Hey, I'm using local packages which I'm importing with path and getting this error:
*** Uncaught error
Bad state: Bad state: 'pub get' failed with the following message: Because every version of [my_aqueduct_package] from path depends on [local_package_via_path] from path which is forbidden, [my_aqueduct_package] from path is forbidden.
So, because runtime_target depends on [my_aqueduct_package] from path, version solving failed.
**** Stacktrace
* #0 Build.getDependencies (package:runtime/src/build.dart:120:7)
* <asynchronous suspension>
* #1 Build.execute (package:runtime/src/build.dart:100:11)
* <asynchronous suspension>
* #2 BuildExecutable.execute (<data:application/dart>:13:259)
* #3 main (<data:application/dart>:9:35)
* #4 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:298:32)
* #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:12)
****
This package is 2 directives up, so it is specified in pubspec.yaml like this:
Hey, I'm using local packages which I'm importing with path and getting this error:
*** Uncaught error
Bad state: Bad state: 'pub get' failed with the following message: Because every version of [my_aqueduct_package] from path depends on [local_package_via_path] from path which is forbidden, [my_aqueduct_package] from path is forbidden.
So, because runtime_target depends on [my_aqueduct_package] from path, version solving failed.
**** Stacktrace
* #0 Build.getDependencies (package:runtime/src/build.dart:120:7)
* <asynchronous suspension>
* #1 Build.execute (package:runtime/src/build.dart:100:11)
* <asynchronous suspension>
* #2 BuildExecutable.execute (<data:application/dart>:13:259)
* #3 main (<data:application/dart>:9:35)
* #4 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:298:32)
* #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:12)
****
This package is 2 directives up, so it is specified in pubspec.yaml like this:
my_local_package:
path: ../../my_local_package
Any help?
Ran into this issue myself today, replacing the local packages with absolute paths in pubspec.yaml fixed it for me.
Activity
itsjoeconway commentedon May 7, 2019
What would be the benefit of AOT compilation for an Aqueduct application?
sriio commentedon May 7, 2019
Many :
Documentation in relation : https://github.com/dart-lang/site-www/blob/a66d468245b84451aa40574db4ba81ee09bd9515/src/_tutorials/server/get-started.md#8-compile-for-production
itsjoeconway commentedon May 7, 2019
How does this compare to snapshotting? A simple, snapshotted Aqueduct app is showing up as 39.6MB of runtime memory usage.
What is the actual reduction in startup time? How is deployment easier? How is the Docker image 'lighter'? How is the overall performance improved compared to JIT for a long-running process like a server application?
sriio commentedon May 7, 2019
Memory usage are similar between snapshot jit and aot. Maybe not the best argument.
App-JIT snapshot vs App-AOT snapshot : https://github.com/dart-lang/sdk/wiki/Snapshots
No runtime, only dartaotruntime executable, your dart.aot and dart.aot.dill files (plus your assets if needed)
Cause of previous point, we don't need google dart image (with runtime) and we can use alpine image for example (maybe scratch with some effort ?)
Tests on my computer show me better performance overall for my simple REST API (response time, processing data). I don't have enough back to argue about long-running process (cause yes I know we loose one of the advantage of JIT on this point).
itsjoeconway commentedon May 7, 2019
I just fired up a snapshotted Aqueduct application and startup time was effectively instantaneous - I'm not sure applications that run for days/weeks/months at a time need a millisecond-order-of-magnitude improvement at startup.
Is deployment really easier? If you're containerizing, I don't see much of a difference here?
Is there a way to measure the size of a Docker image for an AOT vs. JIT compiled images? What are the actual savings quantified? Is there an example of this Dockerfile available?
In your performance testing, have you accounted for JIT? I'm not sure how runtime performance would be any different once the VM is warmed up. What are the actual tests & their measurements you are evaluating here?
sriio commentedon May 7, 2019
In my case, I containerize my app but maybe not everybody ...
I created a sample angel application with 3 docker images (jit, snapshot & aot) (i'm using the official google dart image, aot use ubuntu image) : https://github.com/sriio/sample-dart-hello.
Building images :
Images size :
Stats :
As I said before, I don't have enough back to argue much more on performance. Dart 2.3 is not actually official, I only tested with my case (REST API without templating, etc ...). I can't give you full bench or other. Btw, compare VM warmed up (optimized only for some critical paths and after a huge? delay and amount of calls) against an aot build is not the best idea imo.
itsjoeconway commentedon May 7, 2019
The disk size of the image is significant and worth looking at. There is not a way to disable mirrors right now. We will look at solutions for producing AOT builds. Thanks for putting together the numbers.
sriio commentedon May 8, 2019
Ok, good to hear.
I updated the aot docker image in my sample project. It's even better
listepo commentedon May 23, 2019
It would be great to have AOT compilation for the Aqueduct
itsjoeconway commentedon May 24, 2019
AOT for Aqueduct is currently under development.
Hell0wor1d commentedon May 28, 2019
good job, thanks for sharing.
dunsunik commentedon May 29, 2019
It's gone be a killer feature for us !
Thanks.
itsjoeconway commentedon Jun 27, 2019
Status update:
The first phase of this effort is complete. The effort removed all reflection from the framework and moved it to a separate runtime library (that is used by default when running your application).
The next phase will add a
aqueduct buildcommand that 1) generates a runtime library that doesn't use reflection specific to your project and 2) compiles an AOT build of your project that links to that runtime library instead of the reflection-based runtime.The end result is that you'll be able to run/debug quickly using the same way you do currently (using reflection). When you are ready to ship, you will run
aqueduct buildand it will emit a single binary of your application. edit: The compiled binary will take the same arguments asaqueduct serve.WNemencha commentedon Aug 18, 2019
Hello, any news on this?
itsjoeconway commentedon Aug 18, 2019
Sure thing. Remaining effort:
safe_configis also mirrors-based and needs to provide its own runtime.32 remaining items
nuriamp95 commentedon May 1, 2020
What is the status of this? Thank you for the work
sjapps commentedon May 17, 2020
I'm using this framework for a backend i'm writing. I've been following this thread and I'm hoping to launch my backend service with this. Please tell me this effort isn't abandoned!
lukepighetti commentedon May 17, 2020
Not sure why people think this is abandoned... this is one of the best maintained backend packages I've ever seen.
itsjoeconway commentedon May 18, 2020
It's not abandoned, but it has certainly slowed down as we grapple with a post-Covid business landscape. This feature does exist in the 3.3.0-b1 release, but the dependency on analyzer caused issues with dependency resolution for non-prerelease users. I'd like to push a 4.0.0-b1 with this feature to pub this week.
renlite commentedon May 20, 2020
Why don't you use a builder (like json_serializable) for the ORM during dev-process. So it would be possible to start the server with >dart "appName" (JIT) or to compile the server with >dart2native + start. No more mirrors/reflections.
dxps commentedon Jun 2, 2020
4.0.0-b1update: on macOS (10.15.5),aqueduct buildcreates a working executable! ✨Very small size, instant startup time, fully working:
$ du -hs heroes.aot 7.2M heroes.aot $ $ file heroes.aot heroes.aot: Mach-O 64-bit executable x86_64 $ $ ./heroes.aot [INFO] aqueduct: Server aqueduct/1 started. [INFO] aqueduct: PostgreSQL connecting, heroes@localhost:54322/heroes. [INFO] aqueduct: GET /heroes?name=ap 48ms 200 [INFO] aqueduct: GET /heroes 4ms 200agordeev commentedon Jun 25, 2020
Can
aqueduct: 4.0.0-b1be used as a dependency for Flutter project? I'm trying to use it, but still gettingDart Error: error: import of dart:mirrors is not supported in the current Dart runtimedxps commentedon Jun 25, 2020
IMO you cannot. And I don't even see it as a healthy approach.
That error is simply related to the fact that currently Aqueduct uses
dart:mirrors, and during the AOT build it generates the artifacts (instead of doing the reflection at runtime). That is one of the main features of4.0.0-b1version.Flutter and Aqueduct have different build processes.
Related to the need:
agordeev commentedon Jun 25, 2020
Ah, such a pity. Aqueduct ORM's
Serializedoesn't integrate withjson_serializableat all, so I thought I could use models on both sides.It seems the only way is to implement
toJson/fromJsonon the client side manually, which is a huge drawback.Jonas-Sander commentedon Jul 1, 2020
Hey, I'm using local packages which I'm importing with
pathand getting this error:This package is 2 directives up, so it is specified in
pubspec.yamllike this:Any help?
7-Mav-7 commentedon Jul 31, 2020
Ran into this issue myself today, replacing the local packages with absolute paths in pubspec.yaml fixed it for me.
maurobotta commentedon Jul 31, 2020
When will available 4.0 version (usable) ?
jayjah commentedon Sep 28, 2020
Dart 2.9.2 and Aqueduct 4.0.0-b1 ist not compatible. The aqueduct build command crashed with the following error:
-- Aqueduct CLI Version: 4.0.0-b1
-- Aqueduct project version: 4.0.0-b1
Resolving ASTs...
Generating runtime...
*** Uncaught error
Bad state: Failed assertion: boolean expression must not be null
**** Stacktrace
Are you aware of these error? Do I have do downgrade dart to 2.8 to successfully build an aot snapshot of my server???
BenjaminThong commentedon Oct 30, 2020
Same issue with dart 2.10.2
tusharsadhwani commentedon Nov 10, 2020
^ same issue with 2.10.3 and 2.11 beta