-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Minimal API #15294
Minimal API #15294
Conversation
@sebastienros I did bombarded by localhost using
Here is the output using mimimal API Here is the output using controller |
5xx means all the responses are 500, so it's void. If you ran this command line it's missing the url.
|
Oh see now that all of the are 5xx errr bombardier -c 500 -n 1000000 https://localhost:44300/kb15/api/content/4efeywk0k48f1vbnewk0xwcpxd -H "Authorization: Bearer a token that was generated by postman" let me try it again |
@sebastienros here are better outputs using Minimal APIs Using controller |
This pull request has merge conflicts. Please resolve those before requesting a review. |
# Conflicts: # src/OrchardCore.Modules/OrchardCore.Contents/Controllers/ApiController.cs
This is not something ready for review, right? Because then please make it a draft. |
@Piedone yes. I cleaned it up and fixed the test. It is ready for review. It uses Minimal API for the content API. |
Is the primary goal of this performance? |
Yes. And less complexity since we are using Minimal APIs. |
I'm not sure about the complexity, since it's 25% more code than the controller was :). Do we know though what makes it faster? Because if it's due to it not doing something that the MVC approach does, then we'll need to optimize that too, since we won't rewrite every OC API controller out there. |
You are saving the complexity of creating the controller and its related objects. Minimal API are executed directly like a middleware. We'll ensure that we only resolve services that are needed by the endpoint. If you see the Bombardier output I shared earlier, you'll see that it is able to handle slightly more requests that a controller does. |
I see, thanks. Yep, seen that, it's nice. |
Did you want to review this PR? @sebastienros can you please review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly that there are no logic changes within the endpoints (compared to the actions)? Except for Delete
returning 404 instead of 204 if no item is found.
Correct. At the end of the day, we took the code from a single controller and split it into multiple smaller endpoint level manageable files that get called quicker with less resources. |
Fix #15274