Senpawaii
β
Weird values on accessing Database using EF DbContext under throughput load test
Hello!
I'm testing an ASP.NET application that uses an SQL Database. To access this database I define a dependency service, that I add to my set of services in the following manner:
From my understanding a Db Connection is opened and closed in the scope of each request to my application, that is, each request uses its own connection to the Db.
Upon testing my application, by varying the throughput of requests to the application, I notice that for lower throughput values the average access to the database is around 20ms. Under load, this value drops to 6ms/req. The executed queries are the same.
I would assume that since each request uses its own connection (from the connection pool), the average latency would increase as I increase the throughput. Am I missing any "special" feature of EF that optimizes the accesses to the Db transparently in the background as the load increases?
If this question isn't clear, please feel free to note it, I will try to explain it better π
thanks
12 replies
β Visual Studio 2022 - Debugging error on trying to launch Performance Profiler
Hey!
I'm trying to find the issue behind an error message I'm getting when I try to launch Visual Studio's Performance Profiler over my docker-compose C# project.
The error I get is: "Debugging Error: Unable to find the target operating system for the project <my project name>.
My docker-compose project launches multiple projects (microservices), and I'm only getting this error for 2 of them.
Where does Visual Studio typically search for the target operating system associated with the project? Any ideas on where should I check the target operating system for each project?
This is my docker-compose:
Thanks! ^~^
3 replies
β Accessing HTTP Context at DbCommandInterceptor [.NET 7]
Hi! I'm having some issues trying to access the HTTP Context at my DbCommand Interceptor class.
What I'm trying to achieve is similar to the one presented in: https://stackoverflow.com/questions/75033870/getting-httpcontext-or-just-user-information-into-dbconnectioninterceptor-in
I have tried following advices as present in https://weblogs.asp.net/ricardoperes/accessing-the-httpcontext-from-a-dbcontext , however, when I try to access the HttpContext from the IHttpContextAccessor, I always get a Null object.
Ultimately, what I want to do is inject the IHttpContextAccessor class through the DbContext classβ constructor, so that I can provide it to the Interceptor.
Can someone lend me some much appreciated advice on how to solve this?
This is the implementation of my Interceptor.
5 replies