It is most efficiently measured using Internet Control Message Protocol (ICMP), a protocol used by a utility called "ping ", because it does not have additional computing resources like other common protocols. Ideally, one would want a latency as close to zero as possible.
Latency is dramatically affected by the medium in which the test packet is sent across. For example, if you are on a Wi-Fi connection it is extremely likely that you will have a higher latency to both your internal network as well as the internet. Copper, fiber and other mediums for transport have their own overhead as well.
Lastly, since latency is determined by the sending of a packet to a remote host and back, it means an accurate latency test is also highly dependant on the availability of bandwidth on your connection. A high latency could very well mean that you are maximizing your upload or download speeds on your internet connection or even on local network connections.