Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic: Full AOT Support for Akka.NET #7246

Open
4 tasks
Aaronontheweb opened this issue Jun 11, 2024 · 1 comment
Open
4 tasks

Epic: Full AOT Support for Akka.NET #7246

Aaronontheweb opened this issue Jun 11, 2024 · 1 comment
Labels
AOT Ahead-of-Time (AOT) Compilation discussion
Milestone

Comments

@Aaronontheweb
Copy link
Member

Is your feature request related to a problem? Please describe.

Part of the goal for Akka.NET v1.6 is to be able to get Akka.NET to run everywhere:

  • Games: Unity / Godot
  • Mobile: iOS / Android
  • Embedded Systems
  • x64 / x86
  • ARM

One of the major advantages Akka.NET has over Orleans et al is our versatility - we're not dependent on external cloud infrastructure in order to run. Akka.NET's ability to run in a stand-alone .NET process with in-memory messaging is a tremendous source of value for developers. We should lean into this.

The future of .NET is to expand beyond Windows and even x64 architectures - Ahead-of-Time Compilation, "AOT," is what will open the door for Akka.NET to be able to run on an even larger number of platforms more efficiently than it can today. So for v1.6 we are putting "full AOT support" on the critical path.

Requirements

Where are the problem areas that prevent full AOT support today? My AOT canary implementation on TurboMqtt highlights some of the big ones: petabridge/TurboMqtt#25

  • System.ConfigurationManager - this might already be going bye-bye as part of our discussion to drop .NET Framework support.
  • HOCON-based Type loading - this is all dynamic linking, which is strictly verbotten in AOT (100% static linking.)
  • ExpressionCompiler magic for ReceiveActor, Props, and more: see System.Linq.Expressions - Excessive allocation and prevents AOT scenarios #2811 and other related issues
  • Newtonsoft.Json and default System.Object serialization - we are already planning on moving to Roslyn Source-Generator powered serialization in v1.6, which should address this issue.

All of these will need to be addressed, gradually, by leveraging tools like the Setup class (replaces HOCON-driven Type loading with static-linking-friendly loading) and changing the way some of Akka.NET's built-in components attempt to load configuration.

Things Users Need to Do To Prepare for AOT

If you care about AOT, please read the next sentences carefully:

  • The default ActorSystem.Create experience, with no custom plugins / Akka.Remote / Akka.Cluster / Akka.Persistence et al, will be automatically AOT-friendly out of the box;
  • If you are doing anything more complex than that, move onto https://github.com/akkadotnet/Akka.Hosting or https://github.com/akkadotnet/Akka.Hosting.Maui soon, because the upgrade experience will be fully backwards compatible if you're using either of those platforms. This will make your upgrade much simpler and easier.

If you have any other thoughts or suggestions when it comes to AOT support, please leave them here.

@Aaronontheweb Aaronontheweb added discussion AOT Ahead-of-Time (AOT) Compilation labels Jun 11, 2024
@Aaronontheweb Aaronontheweb added this to the 1.6.0 milestone Jun 11, 2024
@evelant
Copy link

evelant commented Sep 6, 2024

Is AOT possible at all right now? I'm learning F# with an avalonia side project and I'd like to be able to use akka on all platforms avalonia supports (web, ios, android, mac, linux, windows, even embedded).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT Ahead-of-Time (AOT) Compilation discussion
Projects
None yet
Development

No branches or pull requests

2 participants