Reputation: 34248
I have a APS.NET webapi which receives a request, performs a request to another API and returns the HttpResponse from that API back to the client (ie a proxy). Its using a heap of CPU, (much more than the internal API event though they are under the same load).
I did some profiling with ANTs and found that most of the time seems to be spent inside flushing the response stream which seems pretty weird.
The response is fairly simple and has a single double as its content, however the flush method seems to be using approx 60% of the cpu time.
Does anyone know what might be causing this CPU load or what I could do to investigate it?
If its helpful the code is approximately this:
private static HttpClient _client = new HttpClient();
public async Task<HttpResponseMessage> Stuff()
{
return await _client.GetAsync("https://another.api/stuff");
}
Upvotes: 0
Views: 508