Im currently using .NET to develope BE also using entity framework, the connection was fine but when i first called an API, it took like 8s to respond although there’s only 1 data, after the first called it took under 500ms to respond. I tried to figured out why is this happend but still can’t find the solution. Hopefully for an answer, thx.
The initial delay of approximately 8 seconds when calling your API for the first time is likely due to Entity Framework initializing its context, including database connections and query compilation. This process can involve loading metadata and establishing connections, which is optimized after the initial call. Consider optimizing Entity Framework initialization, pre-generating views, and reviewing application startup processes to reduce this delay.
Best regard
Danish hafeez | QA Assistant
ICTInnovations