TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
3.84k stars 400 forks source link

Native AOT #833

Closed Daniel15 closed 4 months ago

Daniel15 commented 5 months ago

Have you considered trying out Native AOT in .NET 8? It lets you compile .NET apps ahead-of-time to native code, and they can run without needing to have the .NET runtime installed, which could make installation easier since users wouldn't have to install the .NET runtime. There's some limitations around things like reflection and dynamic loading of assemblies though, so not all codebases are compatible.

ShreyasZare commented 5 months ago

Thanks for asking. Yes, I had given it a thought but due to the limitations that you have mentioned, its not feasible to use AOT for the project. One of the important features, that is DNS apps rely on dynamic loading of assemblies which is why AOT is not feasible.

rgl commented 4 months ago

@ShreyasZare for me, I would like to have a setup with the minimal moving parts, in the sense of not requiring any external dependencies like the dotnet runtime. have you considered creating a single-file app, which embeds the runtime?

ShreyasZare commented 4 months ago

@ShreyasZare for me, I would like to have a setup with the minimal moving parts, in the sense of not requiring any external dependencies like the dotnet runtime. have you considered creating a single-file app, which embeds the runtime?

@rgl Thanks for asking. The only issue with this is that you wont be able to use any of the DNS apps. If you find that acceptable then its possible to have a native build. But since a lot of features are planned for using DNS apps, it would be quite a big issue.

If your concern is just about installing dotnet runtime then its possible to just extract the dotnet runtime files in a folder and use it directly without having to install it on your system. Another option is to use docker image.

rgl commented 4 months ago

@ShreyasZare indeed, putting the whole runtime (without native aot) in a subdirectory would be nice. wasn't this done only because of the size increase that would bring? or is there something else that I'm missing?

ShreyasZare commented 4 months ago

@ShreyasZare indeed, putting the whole runtime (without native aot) in a subdirectory would be nice. wasn't this done only because of the size increase that would bring? or is there something else that I'm missing?

@rgl If you see the install script available for Linux, it does exactly the same thing. It will download .NET runtime and extract it to /opt/dotnet folder and just create a link to allow using it with command line.

Including the runtime along with the DNS server download will mean that the download size increases significantly and will end up costing a lot in terms of server bandwidth. Also, if the runtime is downloaded separately from Microsoft, you always get the latest update.