WebAPI / Request Queue lifecycle chain

I have an AngularJS app that calls WebAPI. If I log the time when I initiate the request (in my angluar controller) and log the execution time of OnActionExecuting (in the action filter in my WebAPI controller), I sometimes notice a 2 second gap. My guess is that nothing is being run before this filter and this is because requests are blocked / queued. The reason I am assuming is that if I delete all my other data calls, I do not see this break.

How many concurrent requests can WebAPI handle at once? I tried looking at ASP.NET Performance Monitors but couldn't find where I could see this data. Can someone shed some light on this?

+3


source to share


1 answer


There is no direct answer for this, but the shortest one is ...

For WebApi, this doesn't limit the limits of what your server can handle, and how efficient the code you run is.

... But since you asked, let's go over some basic things we can assume about our server and our application ...

  • parallel connections

A typical server is known for problems like "c10k" ... https://en.wikipedia.org/wiki/C10k_problem ... which places a hard limit on the number of concurrent connections.

Assuming every WebApi call is made with, say, some kind of AJAX call on the web page, which gives us a limit of about 10k connections before things get evil.

2. Dependency Overhead

If we then look at the complexity of the code in question, you might have a bottleneck when doing queries like SQL queries, I often write WebApi controllers that have business logic running 10+ db queries, the overhead here might be your problem ?



  1. Overhead filing

How about the network bandwidth on the server? Assuming we are transferring 1MB of data for each call, it shouldn't take long to jam a 1Gbps Ethernet line with messages of this size.

  1. Processing overhead

Assuming you've written an Api that does complex calculations (like mesh generation for complex 3D data), you can easily stifle your CPU for some time on every request.

  1. Timeouts

Assuming the server can accept your request, and the request was made asynchronously, the biggest issue is how long are you willing to wait for a response? Assuming it's pretty short, you have reduced the number of problems you have time to solve before each request and then demanded a response.

...

So, as you can see, this is not a complete list, but it does describe the complexity of the question you asked. However, I would say that WebApi (the framework) has no limitations, it really refers to the infrastructure around it that has limitations to define what might be possible.

0


source







All Articles