Open Leonardo-Ferreira opened 1 year ago
We're not adding another method that is between slim and empty. We already have 3, I'd suggest at this point building your own factory method using CreateEmptyBuilder as a building block.
Note 8.5MB is the size on disk, not in memory.
@davidfowl I wasn't aware of the CreateSlimBuilder()
but perhaps some official documentation on the lines of
//this is equivalent to WebApplication.CreateBuilder();
var builder = WebApplication.CreateEmptyBuilder();
builder.AddThis();
builder.AddThat();
builder.AddAnotherThing();
builder.AddDontYouForgetAboutMe();
this way devs don't need go spelunking on the GitHub for that...
@Leonardo-Ferreira Which editor are you using? I'd expect completion to offer both when you dot into WebApplication
, especially if you've started typing "Create". Normally, I'm all for adding more docs, but it feels a little excessive to cross-link a method so close-by.
Background and Motivation
I have a lot of microservices running on .net and one thing is very certain: they use a lot more memory than CPU... their are host on AKS and this is the big picture of my MEMORY OPTIMIZED pools:
One could argue that yeah, Azure could launch a VM set for 1cpu 8gb ram, but meanwhile, if I want to drive costs down on the hosting, I need to save memory...
Reading that "CreateEmptyBuilder" launches a app at 8.5MB brings tears to my eyes, because YESSSSS my teams will be able to run really slim microservices but also SHIIIIIIIIIT they will screw-up so bad counting on things that are usually there but won't be, like model mapping...
Proposed API
I would like to propose the "CreateMinimalApiBuilder", with just enough to serve the API part of the "WeatherForecast" default template. Nothing else.
A alternative could be template where the builder is explicit and we could just delete/comment things out