Thursday, March 19, 2015

De-mystifying wireless connection speeds


There are a lot of myths and misconceptions about connection speeds in Wi-Fi, and how those wireless connection speeds relate to what we are usually interested in, i.e. throughput.   The story is a complicated one, but this post shall hopefully provide a relatively straightforward explanation of a very complex topic.

Strictly speaking, wireless connection speed is only one of several factors that influence Internet throughput.  Amongst other factors are the available bandwidth into your property, the number of devices simultaneously competing for that bandwidth and the applications they are running, whether the bandwidth is a shared resource (e.g. cable modem) or dedicated resource (e.g. business-class fiber), the bandwidth and utilization of the remote server you are trying to access, etc.  That said, wireless connection speeds, when they are poor, can dominate your user experience.  The Wi-Fi is the infrastructure our devices use to connect to each other and the Internet.  As such, getting the Wi-Fi right is paramount to good network connectivity.

When your device has a strong Wi-Fi signal and is not exposed to interference, high connection speeds are achieved that are generally far above the speed of your Internet connection.  In this case, the bandwidth of your Internet connection (and the number and type of devices and applications on your network) will be the bottleneck of the network.   This is how we nominally design wired and wireless networks.    However, if the Wi-Fi signal is weak, or if the environment has a lot of interference, only low connection rates are possible, and thus the wireless connection becomes the bottleneck of your network.

With every generation of Wi-Fi, connection speeds have increased, often dramatically.  Alas, you cannot break the laws of physics, and the RF of today is the same as when it was discovered approximately 200 years ago.  That said, clever engineering solutions can be devised to push the boundaries of physics.  Fundamentally, all of the improvements in Wi-Fi over the last 20 years have been accomplished by using mathematics to increase complexity, such as adding more complex modulation, less forward error correction, multiple spatial streams, wider channel widths, etc.   The price paid, however, is that complexity increases fragility and decreases robustness.   802.11b is approximately 100x slower than 802.11ac wave 1, but 802.11b went much further distances, still worked reasonably well in the presence of noise and interference, and, most importantly, was quite tolerant of extremely poor design and implementation practices. 

The Wi-Fi connection speed established between two Wi-Fi stations is the Modulation and Coding Scheme, or MCS.
  • Modulation is defined as encoding an analog or digital signal on an electromagnetic wave.  In classic radio, such as the radio in your car, the two mechanisms used are amplitude modulation (AM), where the power level is altered as a function of time, and frequency modulation (FM), where the wavelength is altered as a function of time.  One can also perform phase modulation (PM), which the phase of the signal (i.e. where along the sine wave you are) is shifted as a function of time.  Wi-Fi requires operation on one of several particular channels (i.e at a fixed center frequency and frequency width), so FM is not an option.  Instead, both the amplitude and phase of the signal are modified so that particular combinations of amplitude and phase offsets represent a particular string of bits.   By more finely adjusting the particular amplitude and phase offsets, a larger string of bits can be represented, and thus faster connection rates can be achieved.   Thus, for faster speeds, the more complex the modulation.  The tradeoff, however, is that the amplitude and phase of a signal normally get distorted in all radio communications between a transmitter and receiver due to several factors, including signal loss as a function of distance between the transmitter and receiver, attenuation and reflections off of walls and other objects, and other RF noise in the environment.  Thus, as the modulation becomes more complex, the harder it becomes for the receiver to interpret the receive signal and derive the intended sequence of data bits.
  • Coding, also known as forward error correction, is the process of inserting "error correction bits" into the data stream, so that even if some of bits are misinterpreted during the radio communication process, the original data stream can be reconstructed mathematically.   The amount of forward error correction is typically represented as a ratio:  A coding of 1/2 means that for every 1 data bit, 2 bits are transmitted; a coding of 5/6 means that for every 5 data bits, 6 bits are transmitted.   The more error correction bits that are used in the data stream, the more likely that the receiver will be able to reconstruct the intended sequence of data bits, though the more overhead and thus the fewer actual data bits that get transmitted. 
The MCS rates, therefore, are specific pre-defined combinations of modulation and coding that result in particular uni-directional speeds between two Wi-Fi  stations.  For the fastest speeds, it is desirable to make the modulation as complex as possible and the forward error correction to be as little as possible.   When an AP is advertised with specs like "up to 450 Mbps" for 802.11n or "up to 1.3 Gbps" for 802.11ac, these numbers correspond to the largest MCS supported by that make and model of AP, i.e. the most complex modulation scheme and the fewest error correction bits. 

So what determines the actual rate between the client and the access point? In Wi-Fi, we generally want the fastest connection speed we can get, so the actual speed is targeted to be the best MCS rate at which the receiver can still correctly interpret the intended sequence of data bits.  The specific algorithm as to which MCS rate gets selected is proprietary to each Wi-Fi equipment vendor, though generally it is based on the signal strength, the number of errors measured, and the number of retransmissions required.   This rate is periodically renegotiated over time as a client moves around the environment and thus these parameters change in a process known as dynamic rate shifting

Distance is generally the largest single contributing factor to signal strength, due to an effect called free space path loss, which is simple geometery.  As a signal moves away from its transmitter, it spreads out in space both horizontally and vertically, which means the power level decreases as the square of the distance between the transmitter and receiver.   This effect is illustrated in two dimensions in this figure.



Since the transmit power on the AP is generally higher than the transmit power of a client device, the wireless connection speeds are not necessarily symmetrical in both directions.  An AP broadcasting at a high power level can achieve a relatively strong signal at the client device, allowing for a high MCS rate.  The lower power transmitter at the client device will result in a much weaker signal at the access point, and thus a lower MCS rate.  For certain applications, such as streaming a video from NetFlix, this is usually still ok, since most of the traffic is flowing downstream to your device.   For a two-way FaceTime video chat, your performance will be driven by the weakness of your client device, not the strength of your access point.


Of course, distance isn't the only contributing factor.  Other objects in the path (e.g. walls, ductwork, people, etc.) will serve to attenuate the signal, along with interference from any other sources of noise on the same operating frequency.  In the presence of interference, MCS rates are usually dramatically low, in order to have the simplest forms of modulation and a lot of forward error correction to give the Wi-Fi data stream the greatest possible chance of being received properly.  Even this can be marginal, requiring multiple retransmissions to get any data through, driving down data rates even further.  

In poorly designed or implemented Wi-Fi deployments, self-interference (i.e. interference from your own neighboring access points) dominate, because high power settings lead to too much overlap between the neighboring APs.  If the APs are on the same or adjacent channels, large levels of interference results.  Fortunately, this generally can be fixed, or at least mitigated, by improving channel and power settings and, when necessary, changing AP locations and antennas.  In "un-designed environments", such as apartment buildings where every 1000 sq. ft. apartment has a consumer-grade Wi-Fi modem from a provider designed to cover a 2500 sq. ft. house, all broadcasting on the same channels at their top power settings, the level of interference from neighboring systems is so extreme that there are no good channel or power settings available, and low MCS rates and high levels of retransmissions are unfortunately the norm.

No comments:

Post a Comment