0

I have an asp.net mvc4 web api (rest) interface that is being called by numerous clients. Basically I serve up content per certain params:

http://myserv.x.com/api/123/getstuff?whatstuff=thisstuff

My question is that it gets hit about 50K a day and I am noticing timeouts and slow response times every now and then.

ASK: How can I include metrics of how long the request took to process (internal to my code) as well as how long it took to get serviced in the IIS queue. I'm not sure if the latency is in my code or IIS.

I'd like to add them back within the response somehow:

<StuffPayload>
  <Stuff id=1 url=http://myserv.x.com/img/1/>
  <Response time=100ms IIStime=10ms MyServerCodeTime=90ms/>
</StuffPayload>
genxgeek
  • 13,109
  • 38
  • 135
  • 217
  • 1
    Can you not just look in your IIS logs? Use logparser to search for long running requests. – Darrel Miller Feb 13 '13 at 02:19
  • @DarrelMiller: Thanks Darrel. Haven't used log parser before but is there specific syntax I can user to look for long running queries for my specific request GET/getstuff? – genxgeek Feb 13 '13 at 21:03
  • The answers in this question http://stackoverflow.com/questions/4663262/iis-log-parser-need-query-to-find-total-requests-taking-x-secs-total-re/4664773#4664773 should give you an idea of how to write the query. – Darrel Miller Feb 13 '13 at 21:45

1 Answers1

1

First check what is your method doing: if there's any sql/file operation ensure you create/dispose correctly all resources. You could write custom action filters for logging so you can have a reusable peace of code for all your tracing. You can then add additional content to the response within the OnActionExecuted method.

Giorgio Minardi
  • 2,765
  • 1
  • 15
  • 11