P
Peter
Hi
I am not sure this is really directly c# related, but I am not sure the
best place to post.
I need to be able to determine the rate of requests to my
web-application. That is, how many requests per second I receive.
Actually it's a little more complicated, because I need to determine
the rate of requests per user. For example, user 1 is issuing requests
at 15.3 per second, user 2 at 32.8 per second and so on.
And further to this, my application can be "distributed". That is, it
can be running in multiple locations, but I need to accumulate the
request rate counts for all the locations.
Can anyone help me get started on this?
To start with I need a method for determining a request rate. I have a
method which does this (called Measure). I think this is ok - I call
this method on every request, to calculate a rate. But maybe this
should be averaged over a longer period? Is this neccessary and how can
I do this?
Another area I have trouble with is how to persist this data between
requests. Some sort of common cache available over http or tcp
(soap/webservice/wcf maybe?) - but what if two requests come close
together (or from different machines) - how do I control the updating
of the request rate so it is reliable?
public Info Measure(Info information)
{
information.LastTicks = information.ThisTicks;
long now = 0;
QueryPerformanceCounter(out now);
information.ThisTicks = now;
long diff = information.ThisTicks - information.LastTicks;
if (diff > 0)
{
information.RequestRate = ((double)freq) / diff;
}
return information;
}
public class Info
{
public long ThisTicks { get; set; }
public long LastTicks { get; set; }
public double RequestRate { get; set; }
}
Thanks,
Peter
--
I am not sure this is really directly c# related, but I am not sure the
best place to post.
I need to be able to determine the rate of requests to my
web-application. That is, how many requests per second I receive.
Actually it's a little more complicated, because I need to determine
the rate of requests per user. For example, user 1 is issuing requests
at 15.3 per second, user 2 at 32.8 per second and so on.
And further to this, my application can be "distributed". That is, it
can be running in multiple locations, but I need to accumulate the
request rate counts for all the locations.
Can anyone help me get started on this?
To start with I need a method for determining a request rate. I have a
method which does this (called Measure). I think this is ok - I call
this method on every request, to calculate a rate. But maybe this
should be averaged over a longer period? Is this neccessary and how can
I do this?
Another area I have trouble with is how to persist this data between
requests. Some sort of common cache available over http or tcp
(soap/webservice/wcf maybe?) - but what if two requests come close
together (or from different machines) - how do I control the updating
of the request rate so it is reliable?
public Info Measure(Info information)
{
information.LastTicks = information.ThisTicks;
long now = 0;
QueryPerformanceCounter(out now);
information.ThisTicks = now;
long diff = information.ThisTicks - information.LastTicks;
if (diff > 0)
{
information.RequestRate = ((double)freq) / diff;
}
return information;
}
public class Info
{
public long ThisTicks { get; set; }
public long LastTicks { get; set; }
public double RequestRate { get; set; }
}
Thanks,
Peter
--