Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Poor WebAPI performance

I recently converted our existing ASP.NET MVC 2 application to MVC 4 with a WebAPI backend. Unfortunately though, I have been noticing some severe performance issues in regards to WebAPI.

I have MiniProfiler setup and added some steps to see if I could identify the bottleneck, and to my surprise, it is not the database. Before the conversion, a request like this would take no more than ~50ms, so seeing these simple requests take upwards of 2 seconds is a bit shocking.

enter image description here

The odd part is that all of this is that the majority of the latency occurs before the request even makes it to the SQL calls itself.

I was wondering if there was a known way to more deeply tie MiniProfiler into WebAPI's calls to further inspect what is actually going on here. Any assistance would be greatly appreciated.

FWIW, here is the code being used for this request

WebAPI Controller:

[HttpGet]
public bool AssetExistsById(string assetId) {
    using (Current.Profiler.Step("WebAPI Call To Model")) {
        return Asset.AssetExists(assetId);
    }
}

Asset Model:

public static bool AssetExists(string assetId) {
    using (Current.Profiler.Step("WCF call to DataAccess lib")) {
        return WcfEndPoint.AssetExists(assetId);
    }
}

Thanks!

Update

So I found out what was going on here... It turns out that I had System Diagnostics Tracing enabled in my App_Start/WebApiConfig.cs file. I randomly commented out the following line, and everything was fixed.

config.EnableSystemDiagnosticsTracing();

I hope this helps others!

like image 928
Josh Sullivan Avatar asked Apr 16 '13 17:04

Josh Sullivan


1 Answers

So I found out what was going on here... It turns out that I had System Diagnostics Tracing enabled in my App_Start/WebApiConfig.cs file. I randomly commented out the following line, and everything was fixed.

config.EnableSystemDiagnosticsTracing();

I hope this helps others!

like image 74
Josh Sullivan Avatar answered Nov 09 '22 11:11

Josh Sullivan