I wanted to test latency for my server, so I sent a rest request. Using a rest api client, i got around 500 ms latency from desktop, but when i do the same request on iOS Simulator (using AFNetworking) , I am getting latency of 1.8 seconds.
My server sends keep alive headers, and I noticed that the first request from my PC is of a similar latency as IOS. How do I make iOS honour keep alive , or reduce latency ? Since I am making a realtime app , it is a must that I have low latency. From the same computer , my rest client is about 3x faster than iOS. How may I fix this issue ?
Edit:: I noticed that upon disabling https support from my server, the latency becomes 1 second. To me it is quite obvious that there is some problem with iOS not using keep alive.
I monitored network activity using wireshark. Below is a picture of two http requests made at around 1 second intervals:
It can be seen that encrypted handshake is being done twice.
Using my rest client, this is it what the same http requests at 2 second interval looks like: