Reputation: 2307
How to measure server HttpRequest's performance?
I think it's important task and many peoples solved this challenge.
I will explain. I have many user server requests which calls in parallel and i want measure some Performance metrics of identical requests.
For example:
10:00:00AM request 1 duration 200 ms: /some_request/data
...
11:00:00AM request 2 duration 700 ms: /some_request/data
...
11:30:00AM request 3 duration 300 ms: /some_request/data
...
As you can see the general problem is that duration of requests always jumped, and we can't say about real change of request performance. Difference between duration of identical request's (note: with same json data 1-1) can be unpredictable.
In example i try measure requests duration like that:
public class PerformanceFilter : IActionFilter
{
private Stopwatch timer = new Stopwatch();
public void OnActionExecuting(ActionExecutingContext filterContext)
{
timer.Reset();
timer.Start();
}
public void OnActionExecuted(ActionExecutedContext filterContext)
{
timer.Stop();
var duration = timer.ElapsedMilliseconds;
}
}
May be it's wrong way? Or for detecting of request performance change we can use other request characteristics?
Upvotes: 0
Views: 83
Reputation: 5692
Have you considered the w3c HTTP log value time-taken as an objective method for collecting your timing data? This is taken at the server and misses only the last ack on the finish of the send as a part of the time collection.
One thing you will want to be particularly careful of is when your sample agent or your server is inside of a virtual machine as this impacts clock precision and integrity. The virtual machine clock is unpinned from the hardware clock and "floats." In this float period the clock does slow/degrade slightly and periodically has to be resync'd to the hardware clock. Invariably this will happen when you are timing an event on the virtual machine. This results in an apparent jump in the timed event.
This is a well known problem in the performance testing community which has to design around clock float issues related to timing precision on performance tests where virtual machines are used as load generators.
Upvotes: 1
Reputation: 389
Can you use any tool to measure the performance? If yes give a try with Fiddler..When you make a connection to a website fiddler will start tracking all the requests and responses and from there you select a request and right click - > go to properties and there you can see all the time stamps for the request and response. Hope this helps
Upvotes: 1