0

Scenario is following:

Android application submits a POST/GET request to ASP.NET MVC application sitting on EC2 instance, which then notifies user via SignalR.

Question is, is there a way to measure an exact time (in milliseconds) from the moment when user submits data on the phone, until that information is displayed in the browser for end user.

I have tried to send a timestamp from the phone, deliver it to end user and calculate total time in javascript, but that is not reliable and accurate.

Any ideas?

Robert
  • 3,353
  • 4
  • 32
  • 50

2 Answers2

0

I found the best way of tracking time for such a use case is by adding a timestamp in each phase, in this case: client, asp.net, signalr. This way you have information about each tasks latency, even though the client timestamps are not reliable we can still use the information with boundaries. When the client timestamp is too far from the server timestamp you can discard it. This was the setup in one of my previous jobs that we used to track latency for our web services.

Istvan
  • 7,500
  • 9
  • 59
  • 109
  • Unfortunately, this will not work for us cause we are trying to measure a performance in milliseconds, and if the phone's clock and server/ending user's clock is off by a second, it's already 1000 ms off. – Robert Feb 02 '16 at 08:52
0

You could set up a proxy that relays traffic from the phone to the backend. The proxy would then be able to give you accurate timings for when a request was sent from the client app, and when the response comes back from the server backend.

It would not, however, tell you when the UI was updated and the user could actually access the information but the delay between the app receiving the information and the UI updating is often constant so perhaps you can just add that constant to the measurements.

More about setting up HTTP proxies on mobile devices:

How to change proxy settings in Android (especially in Chrome)

https://www.charlesproxy.com/documentation/faqs/using-charles-from-an-iphone/

Community
  • 1
  • 1
Ragnar
  • 1,122
  • 1
  • 9
  • 16
  • Maybe i understood something wrong, but how would a proxy know accurate travel time if the phone's clock and proxy's clock are not same by a millisecond? – Robert Feb 03 '16 at 16:28
  • The proxy measures the time it takes to complete the request from the moment it arrives from the client (the phone) and until the response has been sent back to the client. The time experienced by the user will also include the time it takes for the request and response to be relay between proxy and phone AND the time it takes for any calculations done client-side before content is show to the user, but these delays are often constant and/or can be very small (e.g. put the proxy server on the same LAN where the WiFi accesspoint is, that the phone is using to connect to the internet) – Ragnar Feb 08 '16 at 11:09