M
M
mefutu2018-03-05 13:59:29
.NET
mefutu, 2018-03-05 13:59:29

NancyFx how to find out the execution time of an asynchronous request?

I have requests processed asynchronously, I need to know the execution time of each request in order to control the load on the server.
PS. I know about stopwatch, all trash synchronize it. NancyFx has Before(before request execution), After(after request execution) pipline's. Here it is in the framework and these modules that matter ...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Yudakov, 2018-03-05
@mefutu

As usual, we detect the moment when the request processing starts and ends on the server side, we calculate the difference:

var sw = new Stopwatch();
sw.Start();
await MySuperCoolJobAsync();
sw.Stop();
Trace.WriteLine($"{sw.ElapsedMilliseconds} мс");

It is necessary to measure the query execution time on the server side.
And on the client side, the load is measured, i.e. The number of requests per second that the server can process.

C
cicatrix, 2018-03-05
@cicatrix

Actually, regardless of the specific implementation, you need to "detect" the start time and end time of the task, look at their difference.
Depending on what time you need (including transport to the server or without it), both the calling component and the task itself can detect.

#
#, 2018-03-05
@mindtester

https://i.imgur.com/xo1QmBg.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question