iPhone Network Roundtrip Time
Before you optimize you need to measure. So I spent an idle afternoon measuring the network roundtrip times in our iPhone application. The results were quite interesting so I'd like to share them with you.
The timings are complete roundtrip times, so they include sending the HTTP request, server response time and decoding the JSON result. I used the most commonly used request of our application for the measurements. It's a simple query that requests a number of entries matching that query from the server. The first graph shows the network roundtrip time (in seconds) as function of the number of requested items on a 1st generation iPhone using WLAN to access the server.So the network roundtrip time is linearly dependent on the size of the JSON document. For these tests the JSON document was GZIP compressed and the communication was SSL encrypted.
In the next test I requested 200 items over different network connections on the same device.These results were quite unexpected. On the slow iPhone CPU I expected a bigger impact of the SSL encryption.
For the final test I also performed the same tests on a iPhone 3GS:These tests show that the CPU time needed to parse the JSON response are a significant part of the complete roundtrip time. Also they show how slow our office WLAN connection really is. I didn't expect that a 3G network would beat a 2 Mbit DSL connection.

