0

I have a rather large solution revolving around a WebAPI project. I ran into some performance issues on a particular web service, and used the built-in performance profiler in VS2013 to find the bottlenecks and deal with them. Eventually I got the response time on a HTTP request down from around 500ms to 50ms (I use an external app to perform repeated requests and log the round-trip time).

However, I only see this improvement while running the WebAPI from the performance profiler tool. As soon as I switch back to running it straight from Visual Studio (F5) or on our test server, the response times increase to around 400ms, still an improvement on the original 500, but not exactly magnificent.

It only makes a slight difference if I run it in debug mode or release mode. Setting "debug info" to "none" rather than the default "pdb-only", on all the involved projects helps a tiny bit, bringing the average response time down to around 350ms.

I can't for the life of me, figure out what the performance profiler tool does to optimize the code further. And it's killing me that I've seen how fast it can run, but I'm unable to achieve the same performance.

2 Answers 2

1

Turns out the performance profiler wasn't doing anything different to optimize the code. But it did run IIS Express without any debuggers enabled.

By going to the Web API project's properties, and switching to the Web-tab, I could uncheck all the debuggers, and now the response times during debugging matched what I was seeing when running the profiler. Obviously disabling the ASP.NET debugger, prevents any debugging of the code.

Sign up to request clarification or add additional context in comments.

Comments

0

Mikal is right.

This performance difference issue (when doing profiling is better than debuging) also has troubled me for a few hours, I even tried to move code from Web API to Console Application to test, and Console Application has similar performance as good as when profiling Web API.

Then I figured out that it is due to ASP.NET debugger was enabled for debugging mode, which consumed a lot CPU, after de-check that debugger, performance is back, as good as Console Application and Profiling mode

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.