How can I measure the breakdown of network time spent in iOS?

Downloading from my application is too slow, and I would like to collect some real data on where the time is spent.

As an example, here are a few steps a query goes through:

  • Initial radio connection (significant delay source in EDGE)
  • DNS lookup (if not cached)
  • SSL / TLS negotiation.
  • Download an HTTP request, including data.
  • Server processing time.
  • Download an HTTP response.

I can solve most of them (for example, turning on the radio earlier with a dummy request, establishing a dummy HTTP 1.1 connection, etc.), but I would like to know which ones really contribute to the network slowdown, the actual devices, with mine actual data using actual cells.

If I used Wi-Fi, I could track their connection with Wireshark and some synchronized clocks, but I need cellular data.

Is there any good way to get this detailed breakdown without having to (gak!) Use the very low level socket functions to play my vanilla http request?

+4
source share
2 answers

Well, the method I would use is not easy, but it works. You may have already tried this, but carry me.

I get a time log indicating the time it took to send each message, the time it took to receive each message, and its duration. If it is associated with several processes or threads, each of them generates a log, and then combines them into a common timeline.

Then I will build a graph. (The tool will be enjoyable, but I did it manually). I am looking for things like 1) messages resubmitted due to timeouts, 2) delays between the time the message was received and the time it took to receive it.

This usually identifies problems that I can fix in code that I can control. This improves the situation, but then I do it all over again, because the chances are very good that I missed something for the last time.

The result was that an asynchronous messaging system could be fast enough as soon as preventable sources of delay were eliminated.

There is a tendency in the publication of performance questions in order to look for corrections to improve the situation. But the real magical fix is ​​to perfect your diagnostic technique so that it tells you what to fix, because it will be different from others.

0
source

A simple solution for this would be after the application was launched, make a Long Polling connection to the server (you can choose when to establish this connection in advance and when to disconnect), but this is a kind of hack if you want to avoid all sniffing packages with less exposure iOS iOS.

0
source

Source: https://habr.com/ru/post/1332981/


All Articles