Using .NET’s NativeAOT to fix the biggest serverless issue

preview_player
Показать описание


This video is sponsored by AWS

Hello everybody I'm Nick and in this video I will show you how you can get started with .NET 7's NativeAOT today and build your lambdas using a custom runtime that can run in AWS. NativeAOT compiles our code into native code and such a compilation can really help eliminate the biggest problem with C# serverless lambdas: cold starts.

Don't forget to comment, like and subscribe :)

Social Media:

#aws #dotnet
Рекомендации по теме
Комментарии
Автор

That's nice. Recently I had to learn Go as the company I work with is migrating from dotnet to Go for mostly memory consumption reasons. With dotnet AOT I hope it will change and bring dotnet to microservices again as I don't really enjoy working with Go as I like with C#

sikor
Автор

Anyone that ever worked with Lambdas needs to be this excited 🤩

gui.ferreira
Автор

Would you consider making a video about TPL with threadpool interactions, execution context, async state machine and all things related and how you can easily run into thread pool starvation if you misuse these techniques?
It's easy to find superficial explainations about these topics on the web, but an indepth guide to everything async would be really valuable I think!
(copy pasted from another vid, in case you missed it)

EikeSchwass
Автор

Awesome video! NativeAOT seems very promising for lambdas. In a future video, it might be nice to test it with ARM64, as it is supposed to perform even better when lambdas are executed in graviton processors

albertocorralesgarcia
Автор

This is the one I've been waiting for 🙂

slang
Автор

Is there a way to use native AOT for azure?

rick
Автор

I am a proponent of near serverless & cashed for sites with logins/financial and return visitors, full serverless & cashed for no login/financial and return visitors, and whatever is easy for your simple one time use per user sites. The secure parts need a server, the rest should probably be pushed once and computed on their hardware.

betterlifeexe
Автор

this was my main complain why not to use c# in lambdas, like mandalorians would say "this is the way" :D

lordicemaniac
Автор

Its rare when dealing with Development that you get both Performance and Savings in memory. I think we are use to the trade off, I can have faster, but have to sacrifice space, or vice-versa. This seems to be a win-win. Awesome stuff.

tanglesites
Автор

Nick, great video! As always!.... Do you know if it can be used for minimal api?

MarianoGomezBidondo
Автор

Thanks for the video. Are you going to give any discounts on your courses for the New Year?

dyrdai
Автор

This looks good to me. Maybe trying out some serverless stuff in the future is not such a bad idea after all.

Thank you for this very interesting video!

thegenxgamerguy
Автор

Hey, great video. I'm new to AOT and Lambdas. I'm a bit confused about what's the best way to handle dependency injection. Do you have any videos/resources? When you add your CustomerRepo, you mention it's a pretty hacky way but I'm struggling to put together a better way. I couldn't get ServiceProvider to work without getting exceptions! Thanks and thanks for the great content as always!

assumingstraw
Автор

What a coincidence. We were fiddling around with a Python 3.9 script that we use for authorizing, which includes boto3 to call and validate the JWT token against AWS services. That method sometimes took about 2000ms+ to execute, especially when it spun down and had to spin up again, basically cold (re)start.

We eventually had to put 2048MBs of ram on that bad boy to get it anywhere near 50ms, not even any lower than that. Removing boto3 all together bumped it down to 5-10ms, which was fine.

Now this cookie crumbles completely different. Makes me want to revisit that pesky crappy Python script.

ReSpawNnL
Автор

Great as always! Quick question though, have you also considered benchmarking the case where you build for and run on arm64? AWS themselves claim even better performance for that option, though that should always be taken with a grain of salt. Speaking from experience, it's basically zero effort configuration-wise (in my case, using the .NET 6 LTS Runtime and provisioned with AWS CDK).

steinkoopjes
Автор

I've been wanting native AOT for years
The problem is when things don't work in every case or without much setup, people attempt to use them and complain.

.Net 7 released with required members being incompatible with the JSON source generators, so I expect to see similar issues with packages that aren't aware native aot is a thing.

computer
Автор

For that reflection issue...
They should say that each reference used a reflection
and allow to have some attribute to say that some some lib explicit said that they not use reflection
so overall that would be much easier to use that feature

kondziossj
Автор

Cool video, is it possible to do the same with Azure Functions?

maksymkyian
Автор

Very interesting, thanks. I can see a possible use case where NativeAOT would be enabled for production environnement builds but not for test environnements builds: it would keep the pace quickly as before for test environnements deployments, but would allow better performances in production.

Ianis
Автор

Hey @nickchapsas, amazing content! But why didn't you run the runtime example with .Net 7 as well?
Any particular reason?
It would be nice to see if all the improvements were from using AoT or if some of it was from the SDK optimizations.
Nonetheless, amazing content!

marcelofernandes
welcome to shbcf.ru