While i am debugging my application i am seeing following log
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executing action method MyApp.HomeController.Index (MyApp) - Validation state: Valid
Any way i can turn of this model validation?
I have tried https://stackoverflow.com/questions/46374994/correct-way-to-disable-model-validation-in-asp-net-core-2-mvc
but still seeing this line in my console logs
My basic idea is to remove as much as unneeded middle-ware as possible. my request is taking so much time after reaching to middleware till my action.
I have to process high load of request. so every millisecond is important for me
My sample app is attached
Also
first request always seem quite slow. how to quick that up?
@KamranShahid there isn't a feature to turn off model binding or validation with MVC. However it's not clear from your application that validation is problematic. Since you opened a couple of issues with the same theme,
1) Try turning on your application log level to Debug or use a profiling tool like AppInsights. Using the VS profiler would also help. Generally the time spent in the user's application code outweighs the time spent by the framework. Consequently micro-optimizing the framework would likely not make a big dent once you have an application put together.
2) MVC is a higher order application framework. The tradeoff of using it's feature set and not having to work with raw HTTP primitives is the added overhead to request processing. The framework is generally optimized, it's nearly not efficient as working with a raw middleware \ HTTP request pipeline. If you have specific scenarios that require latencies numbers smaller than what you get from a Hello World MVC template, you could consider building an application using endpoint routing - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-3.1#endpoint-routing. It should be much closer to the metal.
@KamranShahid there isn't a feature to turn off model binding or validation with MVC. However it's not clear from your application that validation is problematic. Since you opened a couple of issues with the same theme,
- Try turning on your application log level to Debug or use a profiling tool like AppInsights. Using the VS profiler would also help. Generally the time spent in the user's application code outweighs the time spent by the framework. Consequently micro-optimizing the framework would likely not make a big dent once you have an application put together.
- MVC is a higher order application framework. The tradeoff of using it's feature set and not having to work with raw HTTP primitives is the added overhead to request processing. The framework is generally optimized, it's nearly not efficient as working with a raw middleware \ HTTP request pipeline. If you have specific scenarios that require latencies numbers smaller than what you get from a Hello World MVC template, you could consider building an application using endpoint routing - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-3.1#endpoint-routing. It should be much closer to the _metal_.
Thanks Pran,
I wanted to at-least know where that time is spent after my request landed to the server.
My action processing was merely 7 milliseconds while some request processing inside framework is taking 40 to 100 milliseconds. just wanted to know where exact that time is spent and then trying to minimize it where ever it is possible .
I know there would obviously be trade-offs but there there must be ways for bypassing what you not needed