.NET 7 on AWS Lambda with NativeAOT

Поділитися
Вставка
  • Опубліковано 16 лис 2024

КОМЕНТАРІ • 25

  • @zacky7862
    @zacky7862 2 роки тому +6

    Great explanation about NativeAOT. This is very helpful

  • @balaclavacph1880
    @balaclavacph1880 Рік тому

    Thanks for good video. Is it possible to have AOT with Lambda Function Url´s?

    • @serverlessjames
      @serverlessjames  Рік тому +1

      Yes, absolutely. The format of the input event will match the API Gateway HTTP API request. If you follow the instructions on Bryan's blog to build to function, and then these instructions for native AOT you'll be in the right place.
      nodogmablog.bryanhogan.net/2022/08/simple-lambda-function-with-a-function-url/

    • @balaclavacph1880
      @balaclavacph1880 Рік тому +1

      @@serverlessjames Thank you! It would be awesome to get EF Core compatible/with trimmed friendly code for AOT. Hoping it will be possible in .Net 8. Any idea if there is a AOT friendly ORM for .Net out there.. That would be awsome!

    • @serverlessjames
      @serverlessjames  Рік тому +1

      @@balaclavacph1880 there is an open issue on GitHub tracking the EF Core support. Fingers crossed.

  • @disturp
    @disturp 2 роки тому

    Can you do this with the .NET Minimal APIs?

    • @serverlessjames
      @serverlessjames  2 роки тому +2

      You will be able to shortly, yes. I've got an open PR in the Lambda tooling to enable it.
      I've done some tests with a local build of the libraries though, and it's looking fast 🔥

  • @joancomasfdz
    @joancomasfdz 2 роки тому

    How do you debug it locally in Visual Studio 2022?

    • @serverlessjames
      @serverlessjames  2 роки тому +1

      This is a great idea for another video 🎉 I do have a video on my channel on Unit Testing with Lambda. My normal debugging approach is to run my unit tests in debug mode and step through my function code that way.

    • @michaelakin766
      @michaelakin766 Рік тому

      @@serverlessjames I just installed the templates, tried to run this through debug and I get "System.UriFormatException: 'Invalid URI: The hostname could not be parsed.'" Any ideas on how to get this to debug locally?

  • @YTN3rd
    @YTN3rd 2 роки тому

    Those benchmark numbers have been updated and they are now roughly on par with NET 6 for NET 7 AOT 😢

    • @serverlessjames
      @serverlessjames  2 роки тому +1

      Compared to the .NET 6 managed runtime the P50 cold start execution is 70% (778ms to 372ms) faster and the P99 86% (1470ms to 581ms) faster.
      Once warm the difference is about 10%. Compared to .NET 6 native AOT then yeah the numbers are pretty similar.

  • @fatoven4127
    @fatoven4127 Рік тому

    Awesome video. Have you seen an error like this when deploying?
    dotnet\sdk\7.0.100\Sdks\Microsoft.DotNet.ILCompiler\build\Microsoft.NETCore.Native.Publish.targets(58,5): error : Cross-OS native compilation is not supported.

    • @ianknowles
      @ianknowles Рік тому

      I'm getting the same. Docker isn't firing up and been searching round but no answers as of yet...

    • @serverlessjames
      @serverlessjames  Рік тому +1

      Yep, what OS are you compiling on?
      It might also be worth looking at a later video that covers the SAM tooling which simplifies a lot of this work.
      ua-cam.com/video/n21p5Ezlx28/v-deo.html

    • @ianknowles
      @ianknowles Рік тому +1

      @@serverlessjames Ah cheers James I actually watch that video aswell and decided to give the SAM cli a try. Funnily enough after installing that the dotnet tools started working. On windows. Do you work directly for AWS. I have a couple of clients one of which at the moment are having a major reshuffle and rebuild of their system. We had a beautifully orchestrated micro-service system that was just getting hit hard between cold start and connecting to DocDB. As POC built a few bits in rust on Grav but there predominantly .NET so I was quite excited when Native AOT templates were announced.

    • @serverlessjames
      @serverlessjames  Рік тому

      @@ianknowles yeah, it could have been an outdated version of the tooling or something like that ☺️
      Yes, I do work for AWS. what kind of cold starts are you seeing?

    • @ianknowles
      @ianknowles Рік тому

      @@serverlessjames Possibly outdated but I did run the tools installer as prompted then templates shown up in VS.
      As for the cold starts 1.3-2.0 seconds on lambda execution .NET 6 (ready-to-run) with the usual AWS Core, Dynamo, EvBr and S3 clients. DocDB first connection taking a similiar amount of time to connect with the mongodb client. But when your 4 levels of invocation deep those delays compound heavily. A lot of the first requests were taking upto 30s and timing out (sub second on subsequent requests). So we opted to role 8 UX related lambdas into one monolyth so they could share connection. May have to move to something like ELK as we need full text search and regex on mongo style filter is underwhelming if your across more than 10k documents but if you have any ideas on how to remedy then all ears. PS I suspect your reasonably local south of manchester?