Share via

Minimal API is taking too long

Falanga, Rod, DOH 900 Reputation points
2026-02-23T21:15:26.89+00:00

We're getting close to the end of rewriting a legacy ASP.NET WebForms app using Blazor and Minimal APIs. Both are written using .NET 9. A coworker builds and puts both the Blazor app and Minimal API into their respective websites. According to him, it takes ~4 seconds for any minimal API endpoint to respond. I'll have to do some of my own testing, to verify that. Nevertheless, if this holds true, then we'll have some unhappy users.

So, what do you suggest we do to speed up the API's response time?

Developer technologies | ASP.NET | ASP.NET API
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 83,581 Reputation points Volunteer Moderator
    2026-03-01T19:45:47.5633333+00:00

    If they all have. 4 second overhead, it must likely you webapi is timing out connecting to the Kerberos server. And falling back to windows Ntlm. Have your network people do a trace.

    1 person found this answer helpful.
    0 comments No comments

  2. Jack Dang (WICLOUD CORPORATION) 14,955 Reputation points Microsoft External Staff Moderator
    2026-02-24T04:26:03.15+00:00

    Hi @Falanga, Rod, DOH ,

    Thanks for reaching out.

    A few things you can try to speed it up:

    • Warm up the API: Keep the app loaded in memory so it doesn’t have to “wake up” every time. That first request can feel slow if the app hasn’t been used in a while.
    • Optimize per-request work: If your API opens database connections, loads big files, or does heavy calculations on every call, try to reduce that. Do the heavy lifting once if you can, then reuse it.
    • Check the hosting environment: Make sure the server has enough resources, and the app is set up for responsiveness. Even tiny misconfigurations can add a second or two.
    • Measure where the slowdown really is: Sometimes the API itself is fast, but a database call or file operation is the culprit. Logging and performance tools can help pinpoint it.

    Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.


  3. Q&A Assist
    2026-02-23T21:15:35.8466667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To improve the response time of your Minimal API endpoints, consider the following strategies:

    1. Optimize Code: Review the implementation of your API endpoints to ensure they are efficient. Look for any unnecessary computations or blocking calls that could be slowing down the response time.
    2. Asynchronous Programming: Utilize asynchronous programming patterns to avoid blocking threads while waiting for I/O operations, such as database calls or external API requests. This can significantly improve performance under load.
    3. Caching: Implement caching strategies for frequently accessed data. This can reduce the need to recompute or fetch data from a database for every request, thus speeding up response times.
    4. Load Testing: Use tools like Bombardier to simulate load and identify bottlenecks in your API. This will help you understand how your API performs under stress and where optimizations are needed.
    5. ThreadPool Management: Ensure that your application is not experiencing ThreadPool starvation, which can lead to slow performance. Monitor the ThreadPool usage and adjust your application’s threading model if necessary.
    6. Profiling and Diagnostics: Use profiling tools to analyze the performance of your API. This can help identify slow parts of your code and provide insights into where optimizations can be made.
    7. Minimal APIs Benefits: Remember that Minimal APIs are designed for better performance with reduced overhead compared to traditional controller-based APIs. Ensure you are leveraging their advantages effectively.

    By implementing these strategies, you should be able to reduce the response time of your Minimal API endpoints and enhance the overall user experience.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.