Max Dove
Max Dove

Reputation: 115

IIS High and unstable TTFB

I have my MVC application with API used in it running on IIS 6.0(7.0 on production servers). For the API, I use IHttpHandler implementation in API.ashx file.

I have many different API calls being made to my API.ashx file, but I'll tell about one, that has no DB calls, so it's definitely NOT database issue. At the very beginning of ProcessRequest method I've added Diagnostics.Stopwatch to track performance and stopping it at the last method's line. The output of my stopwatch is always stable(+-2ms) and shows 5ms(!!!) in average. But on my site, I see absolutely unstable and different Time to First Byte. It may start from 15ms and may grow up to 1 SECOND, and demonstrates 300 ms in average, but in logs I'll still have my stable 5ms from stopwatch.

This happens on every server I use, even locally(so this is not network related-problem) and on production. BTW all static resources are loaded really fast(<10ms)

Can anyone suggest the solution to this?

Upvotes: 4

Views: 14725

Answers (1)

Deano
Deano

Reputation: 2895

This sounds like a difficult one to diagnose without a little more detail. Could you edit your question and add a waterfall chart showing the slow API call in question? A really good tool to produce waterfall charts is http://webpagetest.org

I also recommend reading this article about diagnosing slow TTFBs.

http://www.websiteoptimization.com/speed/tweak/time-to-first-byte/

It goes into great detail about some of the reasons behind a slow response. Here are some server performance issues that may be slowing down your server.

  • Memory leaks
  • Too many processes / connections
  • External resource delays
  • Inefficient SQL Queries
  • Slow database calls
  • Insuficient server resources
  • Overloaded Shared Servers
  • Inconsistent website response times

Hope that helps!

Upvotes: 3

Related Questions